In this notebook we’ll be looking at the gene-level count data from the RNA-seq. We’ll perform DGE tests for each bioproject separately, look at combining DGE related results using p-value metaanalysis, and look at normalising counts for downstream co-expression analysis.

The first think is to load the data and see what we’re dealing with.

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.2     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.2     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ruv)
library(DESeq2) # bioconductor
## Loading required package: S4Vectors
## Loading required package: stats4
## Loading required package: BiocGenerics
## 
## Attaching package: 'BiocGenerics'
## 
## The following objects are masked from 'package:lubridate':
## 
##     intersect, setdiff, union
## 
## The following objects are masked from 'package:dplyr':
## 
##     combine, intersect, setdiff, union
## 
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## 
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, aperm, append, as.data.frame, basename, cbind,
##     colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
##     get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
##     match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
##     Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
##     table, tapply, union, unique, unsplit, which.max, which.min
## 
## 
## Attaching package: 'S4Vectors'
## 
## The following objects are masked from 'package:lubridate':
## 
##     second, second<-
## 
## The following objects are masked from 'package:dplyr':
## 
##     first, rename
## 
## The following object is masked from 'package:tidyr':
## 
##     expand
## 
## The following object is masked from 'package:utils':
## 
##     findMatches
## 
## The following objects are masked from 'package:base':
## 
##     expand.grid, I, unname
## 
## Loading required package: IRanges
## 
## Attaching package: 'IRanges'
## 
## The following object is masked from 'package:lubridate':
## 
##     %within%
## 
## The following objects are masked from 'package:dplyr':
## 
##     collapse, desc, slice
## 
## The following object is masked from 'package:purrr':
## 
##     reduce
## 
## Loading required package: GenomicRanges
## Loading required package: GenomeInfoDb
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
## 
## Attaching package: 'matrixStats'
## 
## The following object is masked from 'package:dplyr':
## 
##     count
## 
## 
## Attaching package: 'MatrixGenerics'
## 
## The following objects are masked from 'package:matrixStats':
## 
##     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
##     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
##     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
##     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
##     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
##     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
##     colWeightedMeans, colWeightedMedians, colWeightedSds,
##     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
##     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
##     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
##     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
##     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
##     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
##     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
##     rowWeightedSds, rowWeightedVars
## 
## Loading required package: Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## 
## 
## Attaching package: 'Biobase'
## 
## The following object is masked from 'package:MatrixGenerics':
## 
##     rowMedians
## 
## The following objects are masked from 'package:matrixStats':
## 
##     anyMissing, rowMedians
library(vsn) # bioconductor
library(edgeR) # bioconductor
## Loading required package: limma
## 
## Attaching package: 'limma'
## 
## The following object is masked from 'package:DESeq2':
## 
##     plotMA
## 
## The following object is masked from 'package:BiocGenerics':
## 
##     plotMA
library(ggplot2)
library(ggrepel)
library(ggExtra)
library(scales)
## 
## Attaching package: 'scales'
## 
## The following object is masked from 'package:purrr':
## 
##     discard
## 
## The following object is masked from 'package:readr':
## 
##     col_factor
library(HTSFilter)
library(sva)
## Loading required package: mgcv
## Loading required package: nlme
## 
## Attaching package: 'nlme'
## 
## The following object is masked from 'package:IRanges':
## 
##     collapse
## 
## The following object is masked from 'package:dplyr':
## 
##     collapse
## 
## This is mgcv 1.8-42. For overview type 'help("mgcv-package")'.
## Loading required package: genefilter
## 
## Attaching package: 'genefilter'
## 
## The following objects are masked from 'package:MatrixGenerics':
## 
##     rowSds, rowVars
## 
## The following objects are masked from 'package:matrixStats':
## 
##     rowSds, rowVars
## 
## The following object is masked from 'package:readr':
## 
##     spec
## 
## Loading required package: BiocParallel
library("UpSetR")

library(ComplexHeatmap) # bioconductor
## Loading required package: grid
## ========================================
## ComplexHeatmap version 2.16.0
## Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
## Github page: https://github.com/jokergoo/ComplexHeatmap
## Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
## 
## If you use it in published research, please cite either one:
## - Gu, Z. Complex Heatmap Visualization. iMeta 2022.
## - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
##     genomic data. Bioinformatics 2016.
## 
## 
## The new InteractiveComplexHeatmap package can directly export static 
## complex heatmaps into an interactive Shiny app with zero effort. Have a try!
## 
## This message can be suppressed by:
##   suppressPackageStartupMessages(library(ComplexHeatmap))
## ========================================
## 
## 
## Attaching package: 'ComplexHeatmap'
## 
## The following object is masked from 'package:genefilter':
## 
##     dist2
ggplot2::theme_set(ggplot2::theme_bw() +
  ggplot2::theme(
    strip.background = element_rect(
     color="black", fill="white", linewidth=0, linetype="solid"
    ),
    rect = element_rect(
      colour = "black",
      linewidth = 1,
      linetype = "solid"
    )
  )
)

okabe <- c('#000000', '#E69F00', '#56B4E9', '#009E73', '#F0E042', '#0072B2', '#D55E00', '#CC79A7', '#999999')
options(ggplot2.discrete.fill = list(okabe[seq(2, 9, 2)], okabe[2:8], okabe, rep(okabe, 10)))
options(ggplot2.discrete.colour = list(okabe[seq(2, 9, 2)], okabe[2:8], okabe, rep(okabe, 10)))

gg_shape <- function(gg, vals) {gg + scale_shape_manual(values = rep(c(15, 17:20), 100))}
counts_raw <- readr::read_delim("output/feature_counts.tsv", delim = "\t") %>%
  mutate(Geneid = str_remove(Geneid, "gene-"))
## Rows: 11130 Columns: 431
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr   (5): Geneid, Chr, Start, End, Strand
## dbl (426): Length, SRR10189427, SRR10189429, SRR10189431, SRR10189435, SRR10...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(counts_raw)
## # A tibble: 6 × 431
##   Geneid     Chr   Start End   Strand Length SRR10189427 SRR10189429 SRR10189431
##   <chr>      <chr> <chr> <chr> <chr>   <dbl>       <dbl>       <dbl>       <dbl>
## 1 sscle_01g… chr01 416   1399  -         984         635         666         561
## 2 sscle_01g… chr0… 1997… 2294… +;+;+     912         557         551         670
## 3 sscle_01g… chr0… 3349… 3902… -;-       729         225         189         226
## 4 sscle_01g… chr0… 4747… 5128… +;+      1410         762         841         856
## 5 sscle_01g… chr0… 7185… 7735… -;-;-    2091         351         705         567
## 6 sscle_01g… chr01 13600 15537 +        1938         599         654         767
## # ℹ 422 more variables: SRR10189435 <dbl>, SRR10189436 <dbl>,
## #   SRR10189437 <dbl>, SRR10189441 <dbl>, SRR10189442 <dbl>, SRR10189443 <dbl>,
## #   SRR10189447 <dbl>, SRR10189448 <dbl>, SRR10189449 <dbl>, SRR10277943 <dbl>,
## #   SRR10277944 <dbl>, SRR10277945 <dbl>, SRR10277946 <dbl>, SRR10277947 <dbl>,
## #   SRR10277948 <dbl>, SRR10277949 <dbl>, SRR10277950 <dbl>, SRR10277951 <dbl>,
## #   SRR10277952 <dbl>, SRR10277953 <dbl>, SRR10277954 <dbl>, SRR10277955 <dbl>,
## #   SRR10277956 <dbl>, SRR10277957 <dbl>, SRR10277958 <dbl>, …
counts <- counts_raw %>%
  mutate(id=Geneid) %>%
  select(-Chr, -Start, -End, -Strand, -Length, -Geneid)

# There must be a more elegant way to do this...
counts <- counts[, c("id", colnames(counts)[colnames(counts) != "id"])]
head(counts)
## # A tibble: 6 × 426
##   id     SRR10189427 SRR10189429 SRR10189431 SRR10189435 SRR10189436 SRR10189437
##   <chr>        <dbl>       <dbl>       <dbl>       <dbl>       <dbl>       <dbl>
## 1 sscle…         635         666         561         426         263         373
## 2 sscle…         557         551         670         478         362         454
## 3 sscle…         225         189         226         134         140         181
## 4 sscle…         762         841         856         487         458         524
## 5 sscle…         351         705         567        5183        7189        9574
## 6 sscle…         599         654         767         872        1501         901
## # ℹ 419 more variables: SRR10189441 <dbl>, SRR10189442 <dbl>,
## #   SRR10189443 <dbl>, SRR10189447 <dbl>, SRR10189448 <dbl>, SRR10189449 <dbl>,
## #   SRR10277943 <dbl>, SRR10277944 <dbl>, SRR10277945 <dbl>, SRR10277946 <dbl>,
## #   SRR10277947 <dbl>, SRR10277948 <dbl>, SRR10277949 <dbl>, SRR10277950 <dbl>,
## #   SRR10277951 <dbl>, SRR10277952 <dbl>, SRR10277953 <dbl>, SRR10277954 <dbl>,
## #   SRR10277955 <dbl>, SRR10277956 <dbl>, SRR10277957 <dbl>, SRR10277958 <dbl>,
## #   SRR10277959 <dbl>, SRR10277960 <dbl>, SRR10590602 <dbl>, …
meta <- readr::read_delim("input/sra_rnaseq2.tsv", delim = "\t", na = "-") %>%
  mutate(
    host_ = paste0(host_tidyname, host_accession_tidyname),
    organism_ = paste0(organism_tidyname, accession_tidyname),
  ) %>%
  filter(organism != "Sclerotinia trifoliorum")
## Rows: 621 Columns: 30
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr (23): sra, bioproject, biosample, DOI, platform, strategy, stranded, inc...
## dbl  (7): read_length, n_fragments, n_fragments_filtered, n_fragments_aligne...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(meta)
## # A tibble: 6 × 32
##   sra        bioproject  biosample  DOI   platform read_length strategy stranded
##   <chr>      <chr>       <chr>      <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR1582088 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 2 SRR1582089 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 3 SRR1582090 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 4 SRR1582091 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 5 SRR1582133 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 6 SRR1582134 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## # ℹ 24 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <chr>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <chr>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <dbl>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
virus_mapper <- c("DT8SsHADV" = "SsHADV", "DT8" = "VF", "Z113OXSsNSRV1" = "SsNSRV1", "Z11OXSsNSRV1" = "SsNSRV1", "AH98" = "SsNSRV1", "1980" = "VF", "DK3SlaGemV1" = "SlaGemV1", "DK3" = "VF")

meta <- meta %>% mutate(
  infection_stage = case_when(
    (host_tidyname == "Psat") & (hpi < 24) ~ "E",
    (host_tidyname == "Psat") & (24 <= hpi) & (hpi < 48) ~ "M",
    (host_tidyname == "Psat") & (48 <= hpi) ~ "L",
    (host_tidyname == "Gmax") & (hpi < 48) ~ "E",
    (host_tidyname == "Gmax") & (48 <= hpi) & (hpi < 96) ~ "M",
    (host_tidyname == "Gmax") & (96 <= hpi) ~ "L",
    (host_tidyname == "Bnap") & (hpi < 12) ~ "E",
    (host_tidyname == "Bnap") & (12 <= hpi) & (hpi < 48) ~ "M",
    (host_tidyname == "Bnap") & (48 <= hpi) ~ "L",
    (host_tidyname == "Cari") & (hpi < 24) ~ "E",
    (host_tidyname == "Cari") & (24 <= hpi) & (hpi < 24) ~ "M",
    (host_tidyname == "Cari") & (72 <= hpi) ~ "L",
    TRUE ~ NA
  ),
  resistance = case_when(
    (host_tidyname == "Psat") & (host_accession == "Lifter") ~ "Susc",
    (host_tidyname == "Psat") & (host_accession == "PI240515") ~ "Res",
    (host_tidyname == "Gmax") & (host_accession_tidyname == "9144") ~ "Susc",
    (host_tidyname == "Gmax") & (host_accession_tidyname == "91145") ~ "Res",
    (host_tidyname == "Gmax") & (host_accession_tidyname == "ACColibri") ~ "Susc",
    (host_tidyname == "Gmax") & (host_accession_tidyname == "ACColibriOA") ~ "Res",
    (host_tidyname == "Cari") & (host_accession_tidyname == "Kyabra") ~ "Susc",
    (host_tidyname == "Cari") & (host_accession_tidyname == "HatTrick") ~ "Res",
    (host_tidyname == "Bnap") & (host_accession_tidyname == "NingRS1") ~ "Res",
    (host_tidyname == "Bnap") & (host_accession_tidyname == "1703") ~ "Res",
    (host_tidyname == "Lsat") & (host_accession_tidyname %in% c("RedGranoble", "58", "Pallone", "OakLeaf", "KaiserSelbstschluss", "Kahu", "CobhamGreen", "BloodyWarrior", "Ambassador", "Adriatica2", "68", "Simpson", "Saladin", "RomainDeBenicardo")) ~ "Susc",
    (host_tidyname == "Lsat") & (host_accession_tidyname %in% c("Prazan", "Iceberg", "BataviaTezier", "Aspen")) ~ "Res",
    TRUE ~ NA  
  ),
  virus = ifelse(accession_tidyname %in% names(virus_mapper), virus_mapper[accession_tidyname], NA)
) %>% mutate(
  infection_stage = factor(ifelse((!is.na(resistance)) & (!is.na(infection_stage)) & (resistance == "Res"), paste0(infection_stage, "Res"), infection_stage))
) %>% mutate(
  sample = factor(sample),
  host_tidyname = factor(host_tidyname),
  infection_stage = factor(infection_stage),
  resistance = factor(resistance),
  virus = factor(virus),
  hpi = factor(hpi),
  ipvsivtp = factor(ifelse(host_tidyname == "IV", "IV", ifelse(is.na(infection_stage), NA, paste0(host_tidyname, "_", infection_stage))))
)

head(meta %>% select(sra, bioproject, host_tidyname, sample, infection_stage, resistance, virus, ipvsivtp))
## # A tibble: 6 × 8
##   sra        bioproject  host_tidyname sample   infection_stage resistance virus
##   <chr>      <chr>       <fct>         <fct>    <fct>           <fct>      <fct>
## 1 SRR1582088 PRJNA261444 Psat          PRJNA26… E               Susc       <NA> 
## 2 SRR1582089 PRJNA261444 Psat          PRJNA26… E               Susc       <NA> 
## 3 SRR1582090 PRJNA261444 Psat          PRJNA26… M               Susc       <NA> 
## 4 SRR1582091 PRJNA261444 Psat          PRJNA26… M               Susc       <NA> 
## 5 SRR1582133 PRJNA261444 Psat          PRJNA26… L               Susc       <NA> 
## 6 SRR1582134 PRJNA261444 Psat          PRJNA26… L               Susc       <NA> 
## # ℹ 1 more variable: ipvsivtp <fct>

OK. The data is in, let’s look at the counts.

ggplot(meta, aes(x=sra, y=n_fragments_aligned, fill=included)) +
  geom_bar(stat="identity") +
  facet_wrap(vars(bioproject), scales="free")
## Warning: Removed 5 rows containing missing values (`position_stack()`).

So you should see that there are several bioprojects that I’ve excluded on the basis of multimapping reads, generally low read coverage, etc. The samples labelled “network only” are excluded from DGE because they are unreplicated. However they may be of interest to identify co-expressed genes.

You should also see that we have a pretty wide range of coverage. Typically the most dramatic differences are between samples in planta and in vitro.

Sometimes a biological treatment will be split across multiple sequencing runs. I’ll check for this now.

multi_biosample <- meta %>% group_by(biosample) %>% summarise(n = n_distinct(sra)) %>% filter(n > 1) %>% .[["biosample"]]

for (m in multi_biosample) {
  print(meta[meta$biosample == m, ])
}
## # A tibble: 6 × 36
##   sra        bioproject  biosample  DOI   platform read_length strategy stranded
##   <chr>      <chr>       <chr>      <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR1582088 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 2 SRR1582089 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 3 SRR1582090 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 4 SRR1582091 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 5 SRR1582133 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 6 SRR1582134 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 6 × 36
##   sra        bioproject  biosample  DOI   platform read_length strategy stranded
##   <chr>      <chr>       <chr>      <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR1582140 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 2 SRR1582148 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 3 SRR1582200 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 4 SRR1582201 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 5 SRR1582461 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 6 SRR1582462 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 6 × 36
##   sra        bioproject  biosample  DOI   platform read_length strategy stranded
##   <chr>      <chr>       <chr>      <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR1582469 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 2 SRR1582470 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 3 SRR1582471 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 4 SRR1582472 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 5 SRR1582473 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 6 SRR1582474 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra        bioproject  biosample  DOI   platform read_length strategy stranded
##   <chr>      <chr>       <chr>      <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR8306347 PRJNA379694 SAMN06618… http… ILLUMINA         100 SE       R       
## 2 SRR8306348 PRJNA379694 SAMN06618… http… ILLUMINA         100 SE       R       
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra        bioproject  biosample  DOI   platform read_length strategy stranded
##   <chr>      <chr>       <chr>      <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR8305679 PRJNA379694 SAMN10587… http… ILLUMINA         100 SE       R       
## 2 SRR8305680 PRJNA379694 SAMN10587… http… ILLUMINA         100 SE       R       
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 12 × 36
##    sra        bioproject  biosample DOI   platform read_length strategy stranded
##    <chr>      <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
##  1 SRR9200308 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
##  2 SRR9200309 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
##  3 SRR9200310 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
##  4 SRR9200311 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
##  5 SRR9200312 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
##  6 SRR9200313 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
##  7 SRR9200314 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
##  8 SRR9200315 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
##  9 SRR9200316 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
## 10 SRR9200317 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
## 11 SRR9200318 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
## 12 SRR9200319 PRJNA546228 SAMN1193… http… ILLUMINA         150 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 12 × 36
##    sra         bioproject biosample DOI   platform read_length strategy stranded
##    <chr>       <chr>      <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
##  1 SRR10590602 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
##  2 SRR10590603 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
##  3 SRR10590604 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
##  4 SRR10590605 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
##  5 SRR10590606 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
##  6 SRR10590607 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
##  7 SRR10590608 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
##  8 SRR10590609 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
##  9 SRR10590610 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
## 10 SRR10590611 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
## 11 SRR10590612 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
## 12 SRR10590613 PRJNA5937… SAMN1348… http… ILLUMINA         150 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 6 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR12072338 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 2 SRR12072339 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 3 SRR12072340 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 4 SRR12072341 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 5 SRR12072344 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 6 SRR12072345 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 6 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR12072334 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 2 SRR12072335 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 3 SRR12072336 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 4 SRR12072337 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 5 SRR12072342 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## 6 SRR12072343 PRJNA641217 SAMN1534… <NA>  ILLUMINA         150 PE       FR      
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 6 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR12077446 PRJNA641462 SAMN1535… <NA>  ILLUMINA         150 PE       FR      
## 2 SRR12077447 PRJNA641462 SAMN1535… <NA>  ILLUMINA         150 PE       FR      
## 3 SRR12077448 PRJNA641462 SAMN1535… <NA>  ILLUMINA         150 PE       FR      
## 4 SRR12077449 PRJNA641462 SAMN1535… <NA>  ILLUMINA         150 PE       FR      
## 5 SRR12077450 PRJNA641462 SAMN1535… <NA>  ILLUMINA         150 PE       FR      
## 6 SRR12077451 PRJNA641462 SAMN1535… <NA>  ILLUMINA         150 PE       FR      
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 3 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR13570946 PRJNA695466 SAMN1761… http… ILLUMINA         150 PE       FR      
## 2 SRR13570947 PRJNA695466 SAMN1761… http… ILLUMINA         150 PE       FR      
## 3 SRR13570948 PRJNA695466 SAMN1761… http… ILLUMINA         150 PE       FR      
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 3 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR13570943 PRJNA695466 SAMN1761… http… ILLUMINA         150 PE       FR      
## 2 SRR13570944 PRJNA695466 SAMN1761… http… ILLUMINA         150 PE       FR      
## 3 SRR13570945 PRJNA695466 SAMN1761… http… ILLUMINA         150 PE       FR      
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 6 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR15058739 PRJNA744325 SAMN2008… http… ILLUMINA         150 PE       unstran…
## 2 SRR15058740 PRJNA744325 SAMN2008… http… ILLUMINA         150 PE       unstran…
## 3 SRR15058741 PRJNA744325 SAMN2008… http… ILLUMINA         150 PE       unstran…
## 4 SRR15058742 PRJNA744325 SAMN2008… http… ILLUMINA         150 PE       unstran…
## 5 SRR15058743 PRJNA744325 SAMN2008… http… ILLUMINA         150 PE       unstran…
## 6 SRR15058744 PRJNA744325 SAMN2008… http… ILLUMINA         150 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227239 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227240 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227241 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227242 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227243 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227244 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227245 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227246 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227247 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227248 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227249 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227250 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227257 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227258 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227259 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227260 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227261 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227262 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227263 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227264 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
## # A tibble: 2 × 36
##   sra         bioproject  biosample DOI   platform read_length strategy stranded
##   <chr>       <chr>       <chr>     <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR22227265 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## 2 SRR22227266 PRJNA899438 SAMN3165… <NA>  ILLUMINA         100 PE       unstran…
## # ℹ 28 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …

Ok. So these all seem to be treatment replicates. I’m not going to worry about combining any counts.

We’ll exclude any samples that we aren’t going to keep right now. And I want to convert the table to a long format which i can use to select subsets very easily.

meta <- meta[meta$included %in% c("TRUE", "NETWORK_ONLY"), ]

lcounts <- dplyr::inner_join(
  meta,
  tidyr::pivot_longer(counts, -id, names_to = "sra", values_to = "count"),
  by = "sra"
) %>% mutate(cpm = count / (n_fragments_aligned / 1000000)) %>%
  select(-platform, -read_length, -strategy, -stranded, -n_fragments, -n_fragments_filtered, -n_fragments_aligned, -n_fragments_aligned_single, -n_fragments_aligned_multi, -notes, -DOI, -biosample)

head(lcounts)
## # A tibble: 6 × 27
##   sra        bioproject  included sample    organism organism_tidyname accession
##   <chr>      <chr>       <chr>    <fct>     <chr>    <chr>             <chr>    
## 1 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 2 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 3 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 4 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 5 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 6 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## # ℹ 20 more variables: accession_tidyname <chr>, host <chr>,
## #   host_tidyname <fct>, host_accession <chr>, host_accession_tidyname <chr>,
## #   tissue <chr>, hpi <fct>, plant_tissue <chr>, treatment <chr>,
## #   treatment_tidy <chr>, sample_material <chr>, host_ <chr>, organism_ <chr>,
## #   infection_stage <fct>, resistance <fct>, virus <fct>, ipvsivtp <fct>,
## #   id <chr>, count <dbl>, cpm <dbl>

Let’s have a look at some PCA plots.

tmp <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = cpm) %>%
  column_to_rownames("id") %>%
  as.matrix()

pca_raw <- princomp(tmp, fix_sign = TRUE)

prop_var <- ((pca_raw$sdev[1:10] / sum(pca_raw$sdev[1:10])) * 100) %>%
  data.frame(variance_explained = .) %>%
  rownames_to_column("PC") %>%
  mutate(PC = paste0("PC", sprintf("%02d", 1:n())))

ggplot(prop_var, aes(x=PC, y=variance_explained)) + geom_bar(stat = "identity")

The first PC explains a fairly large amount of variance. I wasn’t expecting to get much reduction in this dataset.

pca <- as.data.frame(pca_raw$loadings[, 1:10])
colnames(pca) <- paste0("PC", sprintf("%02d", seq_len(ncol(pca))))
pca <- pca %>% rownames_to_column("sra")
pca <- right_join(meta, pca, by = "sra")
head(pca)
## # A tibble: 6 × 46
##   sra        bioproject  biosample  DOI   platform read_length strategy stranded
##   <chr>      <chr>       <chr>      <chr> <chr>          <dbl> <chr>    <chr>   
## 1 SRR1582088 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 2 SRR1582089 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 3 SRR1582090 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 4 SRR1582091 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 5 SRR1582133 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## 6 SRR1582134 PRJNA261444 SAMN03074… http… ILLUMINA         150 PE       unstran…
## # ℹ 38 more variables: n_fragments <dbl>, n_fragments_filtered <dbl>,
## #   n_fragments_aligned <dbl>, n_fragments_aligned_single <dbl>,
## #   n_fragments_aligned_multi <dbl>, included <chr>, sample <fct>,
## #   organism <chr>, organism_tidyname <chr>, accession <chr>,
## #   accession_tidyname <chr>, host <chr>, host_tidyname <fct>,
## #   host_accession <chr>, host_accession_tidyname <chr>, tissue <chr>,
## #   hpi <fct>, plant_tissue <chr>, treatment <chr>, treatment_tidy <chr>, …
gg <- ggplot(pca, aes(x=PC01, y=PC02, color=host_tidyname, shape=host_tidyname, fill=host_tidyname)) +
  geom_point(alpha = 0.7, size = 3)

gg <- gg_shape(gg, pca$host_tidyname)
print(gg)

gg <- ggplot(pca, aes(x=PC03, y=PC04, color=host_tidyname, fill=host_tidyname, shape=host_tidyname)) +
  geom_point(alpha = 0.7, size = 3)

gg <- gg_shape(gg, pca$host_tidyname)
gg

Well, the first and second axes seem to be picking something up with B. napus samples, and maybe some unusual in-vitro samples. It looks like the B. napus samples are going to be dominating the data. Possibly just because there’s more of it.

gg <- ggplot(pca, aes(x=PC01, y=PC02, color=bioproject, fill=bioproject, shape=bioproject)) +
  geom_point(alpha = 0.7, size = 3)

gg <- gg_shape(gg, pca$bioproject)
print(gg)

gg <- ggplot(pca, aes(x=PC03, y=PC04, color=bioproject, fill=bioproject, shape=bioproject)) +
  geom_point(alpha = 0.7, size = 3)

gg <- gg_shape(gg, pca$bioproject)
print(gg)

It does seem that the little clusters are at least coming from the same bioprojects, which is encouraging. Maybe a heatmap would be nice to show how the different experiments are (dis)similar.

# Utility function from https://jokergoo.github.io/2020/05/11/set-cell-width/height-in-the-heatmap/
calc_ht_size = function(ht, unit = "inches") {
    pdf(NULL)
    ht = draw(ht)
    w = ComplexHeatmap:::width(ht)
    w = convertX(w, unit, valueOnly = TRUE)
    h = ComplexHeatmap:::height(ht)
    h = convertY(h, unit, valueOnly = TRUE)
    dev.off()

    c(w, h)
}

We’ll look at clustering the samples to see if natural groups fall out from a correlation matrix.

tmp <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = cpm) %>%
  column_to_rownames("id") %>%
  as.matrix()

tmp <- log(tmp + 1, base = 2)

tmp_cor <- cor(tmp)
tmp_dist <- as.dist(1 - tmp_cor)
hcl <- hclust(tmp_dist, method = "average")

srrs <- colnames(tmp)[hcl$order]
ha <- HeatmapAnnotation(
  bioproject = meta %>% column_to_rownames("sra") %>% .[srrs, "bioproject"],
  host = meta %>% column_to_rownames("sra") %>% .[srrs, "host"]
)

ht <- Heatmap(
  tmp_cor,
  name = "samples",
  cluster_rows = hcl,
  cluster_columns = hcl,
  show_column_dend = FALSE,
  show_column_names = FALSE,
  show_row_names = FALSE,
  top_annotation = ha,
  height=nrow(tmp_cor) * unit(0.5, "mm"),
  width=ncol(tmp_cor) * unit(0.5, "mm")
)

htsize <- calc_ht_size(ht)
htsize
## [1] 12.822730  8.906201
pdf("output/06-samples_correlation_clustered.pdf", width = htsize[1], height = htsize[2])
ht
dev.off()
## png 
##   2
draw(ht)

So you can see from the top-colour bar that the clusters are a mixture of bioprojects and hosts. Host tends to form larger blocks, but not all samples from the same host are positioned together.

Next we’ll look at an unclustered matrix, so samples from the same bioproject should occur together.

tmp <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = cpm) %>%
  column_to_rownames("id") %>%
  as.matrix()

tmp <- log(tmp + 1, base = 2)

tmp_cor <- cor(tmp)
#tmp_dist <- as.dist(1 - tmp_cor)
#hcl <- hclust(tmp_dist, method = "average")

#srrs <- colnames(tmp)[hcl$order]
ha <- HeatmapAnnotation(
  bioproject = meta %>% column_to_rownames("sra") %>% .[colnames(tmp), "bioproject"],
  host = meta %>% column_to_rownames("sra") %>% .[colnames(tmp), "host"]
)

ht <- Heatmap(
  tmp_cor,
  name = "samples",
  cluster_rows = FALSE,
  cluster_columns = FALSE,
  show_column_dend = FALSE,
  show_column_names = FALSE,
  show_row_names = FALSE,
  top_annotation = ha,
  height=nrow(tmp_cor) * unit(0.5, "mm"),
  width=ncol(tmp_cor) * unit(0.5, "mm")
)

htsize <- calc_ht_size(ht)
htsize
## [1] 12.409344  8.906201
pdf("output/06-samples_correlation_bioproject.pdf", width = htsize[1], height = htsize[2])
ht
dev.off()
## png 
##   2
draw(ht)

And finally we’ll look at host.

tmp <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = cpm) %>%
  column_to_rownames("id") %>%
  as.matrix()

tmp <- log(tmp + 1, base = 2)
meta_tmp <- meta[order(meta$host, meta$host_accession, meta$hpi, meta$tissue, meta$accession, meta$plant_tissue, meta$treatment),]
tmp <- tmp[, meta_tmp$sra[meta_tmp$sra %in% colnames(tmp)]]

tmp_cor <- cor(tmp)
#tmp_dist <- as.dist(1 - tmp_cor)
#hcl <- hclust(tmp_dist, method = "average")

#srrs <- colnames(tmp)[hcl$order]
ha <- HeatmapAnnotation(
  bioproject = meta %>% column_to_rownames("sra") %>% .[colnames(tmp), "bioproject"],
  host = meta %>% column_to_rownames("sra") %>% .[colnames(tmp), "host"]
)

ht <- Heatmap(
  tmp_cor,
  name = "samples",
  cluster_rows = FALSE,
  cluster_columns = FALSE,
  show_column_dend = FALSE,
  show_column_names = FALSE,
  show_row_names = FALSE,
  top_annotation = ha,
  height=nrow(tmp_cor) * unit(0.5, "mm"),
  width=ncol(tmp_cor) * unit(0.5, "mm")
)

htsize <- calc_ht_size(ht)
htsize
## [1] 12.409344  8.906201
pdf("output/06-samples_correlation_host.pdf", width = htsize[1], height = htsize[2])
ht
dev.off()
## png 
##   2
draw(ht)

There are a couple of good clusters there. It looks like the Lettuce (Lactuca sativa) samples are all well correlated. We’ll see i guess.

Differential gene expression

So i’m going to need to process each experiment separately. Which means some quick PCA, dispersion, and applying the contrasts. To save time i’ll try to automate as much as I can.

We’ll use DESeq2, which is my favourite as it handles genes with low counts better than EdgeR.

Here are the different bioprojects.

unique(meta$bioproject)
##  [1] "PRJNA261444" "PRJNA327437" "PRJNA341340" "PRJNA418121" "PRJNA471709"
##  [6] "PRJNA477716" "PRJNA501892" "PRJNA516496" "PRJNA574280" "PRJNA577619"
## [11] "PRJNA593737" "PRJNA601001" "PRJNA603456" "PRJNA607858" "PRJNA641217"
## [16] "PRJNA641462" "PRJNA643804" "PRJNA647983" "PRJNA670487" "PRJNA687280"
## [21] "PRJNA695466" "PRJNA706136" "PRJNA735329" "PRJNA744751" "PRJNA766564"
## [26] "PRJNA777355" "PRJNA789389" "PRJNA804213" "PRJNA830457" "PRJNA874732"
plotPCA2 <- function(dds, f1, f2) {
  pcaData <- plotPCA(
    dds,
    ntop = 1000,
    intgroup = c(f1, f2),
    returnData = TRUE
  )

  percentVar <- round(100 * attr(pcaData, "percentVar"))

  gg <- ggplot(pcaData, aes(x = PC1, y = PC2, color = .data[[f1]], shape = .data[[f2]])) +
    geom_point(size=3, alpha=0.75) +
    xlab(paste0("PC1: ", percentVar[1], "% variance")) +
    ylab(paste0("PC2: ", percentVar[2], "% variance"))
  
  gg <- gg_shape(gg, pcaData[[f2]])
  return(gg)
}

# Converts 0 to the smallest possible number before log calc
get_log <- function(vec){
  vec[vec == 0] <- .Machine$double.xmin
  vec <- -log10(vec)
}

reverselog_trans <- function(base = exp(1)) {
    trans <- function(x) -log(x, base)
    
    inv <- function(x) base^(-x)
    trans_new(paste0("reverselog-", format(base)), trans, inv, 
              log_breaks(base = base), 
              domain = c(1e-100, Inf))
}


plot_volcano <- function(df, title=NA, nlabels = 5, padj_threshold = 0.05) {
  df <- df[!is.na(df$padj), ]

  df_up <- df[(df$log2FoldChange > 0),]
  df_up <- df_up[order(df_up$padj),]

  df_up$label <- NA
  df_up$label[1:nlabels] <- rownames(df_up)[1:nlabels]

  df_down <- df[(df$log2FoldChange <= 0),]
  df_down <- df_down[order(df_down$padj),]
  df_down$label <- NA
  df_down$label[1:nlabels] <- rownames(df_down)[1:nlabels]

  df <- rbind(df_up, df_down)
  
  gg <- df %>%
    as.data.frame() %>%
    ggplot(aes(y=padj, x=log2FoldChange, colour=padj < padj_threshold, label = label)) +
    geom_text_repel(colour="black", box.padding=0.3, min.segment.length = 0, size=3) +
    geom_point(alpha=0.5) +
    scale_y_continuous(trans = reverselog_trans(10)) +
    ylab("adjusted p-value") +
    xlab(expression(paste(log[2] * " FC"))) +
    labs(colour=paste0("adj. p < ", padj_threshold)) +

  if ( !is.na(title) ) {
    gg <- gg + ggtitle(title)
  }  

  gg <- ggMarginal(gg, margins = "x", type="histogram", fill="lightgrey", xparams = list(bins = 100, linewidth = 0.25, fill = "black"), size=4)

  return(gg)
}


process_contrast_mat <- function(contrasts, this_meta) {
  bpr = unique(this_meta[["bioproject"]])
  stopifnot(all(this_meta[["bioproject"]] == bpr))

  colnames(contrasts) <- c("sample1", "sample2", "contrast_group")
  contrasts <- as.data.frame(contrasts)
  contrasts["contrast"] <- apply(contrasts, MARGIN = 1, FUN = function(x) {paste0(x["sample1"], "_vs_", x["sample2"])})
  contrasts["bioproject"] <- bpr
  contrasts <- dplyr::left_join(
    contrasts,
    this_meta %>% select(sample1 = sample, host1 = host_tidyname, infection_stage1 = infection_stage) %>% unique(),
    by="sample1"
  )
  
  contrasts <- dplyr::left_join(
    contrasts,
    this_meta %>% select(sample2 = sample, host2 = host_tidyname, infection_stage2 = infection_stage) %>% unique(),
    by="sample2"
  )
  
  contrasts <- contrasts[, c('contrast_group', 'bioproject', 'contrast', 'sample1', 'sample2', 'host1', 'host2', 'infection_stage1', 'infection_stage2')] %>%
    mutate(sample1 = as.factor(sample1), sample2 = as.factor(sample2), host1 = as.factor(host1), host2 = as.factor(host2), infection_stage1 = as.factor(infection_stage1), infection_stage2 = as.factor(infection_stage2))
  return(contrasts)
}


process_host_contrast_mat <- function(this_meta) {
  bpr = unique(this_meta[["bioproject"]])
  stopifnot(all(this_meta[["bioproject"]] == bpr))

  names <- unique(as.character(this_meta[["host_tidyname"]]))
  mat <- expand.grid(names, names) %>%
    filter(Var1 != "IV") %>%
    mutate(
      bioproject = bpr,
      contrast = paste0(bpr, "_", Var1, "vs", Var2),
      contrast_group = ifelse(Var2 == "IV", "IPvsIV", paste0(Var1, "vs", Var2)),
      infection_stage1 = as.factor(NA),
      infection_stage2 = as.factor(NA),
      resistance1 = as.factor(NA),
      resistance2 = as.factor(NA),
      virus1 = as.factor(NA),
      virus2 = as.factor(NA)
    ) %>%
    rename(
      Var1 = "host1",
      Var2 = "host2"
    ) %>%
    filter(host1 != host2) %>%
    select(contrast_group, bioproject, contrast, host1, host2, infection_stage1, infection_stage2, virus1, virus2, resistance1, resistance2)
  return(mat)
}


process_ipvsivtp_contrast_mat <- function(this_meta) {
  bpr = unique(this_meta[["bioproject"]])
  stopifnot(all(this_meta[["bioproject"]] == bpr))

  names <- unique(as.character(this_meta[["ipvsivtp"]]))

  mat <- expand.grid(names, names) %>%
    filter(Var1 != "IV", Var2 == "IV") %>%
    mutate(
      bioproject = bpr,
      contrast_group = paste0("IPvsIV_", gsub("^[^_]+_", "", Var1, perl = TRUE)),
      contrast = paste0(bpr, "_", Var1, "vs", Var2),
      infection_stage1 = as.factor(gsub("^[^_]+_", "", Var1, perl = TRUE)),
      infection_stage2 = as.factor(NA),
      resistance1 = as.factor(NA),
      resistance2 = as.factor(NA),
      virus1 = as.factor(NA),
      virus2 = as.factor(NA)
    ) %>%
    rename(
      Var1 = "host1",
      Var2 = "host2"
    ) %>%
    filter(host1 != host2) %>%
    select(contrast_group, bioproject, contrast, host1, host2, infection_stage1, infection_stage2, virus1, virus2, resistance1, resistance2)
  return(mat)
}


process_timepoint_contrast_mat <- function(this_meta) {
  bpr = unique(this_meta[["bioproject"]])
  stopifnot(all(this_meta[["bioproject"]] == bpr))

  names <- unique(as.character(this_meta[["host_tidyname"]]))
  names <- names[names != "IV"]
  infection_stage <- unique(as.character(this_meta[["infection_stage"]]))
  infection_stage <- infection_stage[!is.na(infection_stage)]
  
  mat <- expand.grid(names, infection_stage, infection_stage) %>%
    mutate(
      bioproject = bpr,
      contrast_group = paste0(Var2, "vs", Var3),
      contrast = paste0(bpr, "_", Var1, "_", Var2, "vs", Var3),
      host1 = Var1,
      host2 = Var1,
      resistance1 = as.factor(NA),
      resistance2 = as.factor(NA),
      virus1 = as.factor(NA),
      virus2 = as.factor(NA)
    ) %>%
    rename(
      Var2 = "infection_stage1",
      Var3 = "infection_stage2"
    ) %>%
    filter(
      contrast_group %in% c("MvsE", "LvsE", "LvsM", "MResvsERes", "LResvsERes", "LResvsMRes")
    ) %>%
    select(contrast_group, bioproject, contrast, host1, host2, infection_stage1, infection_stage2, virus1, virus2, resistance1, resistance2)
  return(mat)
}

process_resistance_contrast_mat <- function(this_meta) {
  bpr = unique(this_meta[["bioproject"]])
  stopifnot(all(this_meta[["bioproject"]] == bpr))

  names <- unique(as.character(this_meta[["host_tidyname"]]))
  names <- names[names != "IV"]
  resistance <- unique(as.character(this_meta[["resistance"]]))
  resistance <- resistance[!is.na(resistance)]
  
  mat <- expand.grid(names, resistance, resistance) %>%
    filter(
      Var2 == "Susc",
      Var3 == "Res"
    ) %>%
    mutate(
      bioproject = bpr,
      contrast_group = paste0(Var2, "vs", Var3),
      contrast = paste0(bpr, "_", Var1, "_", Var2, "vs", Var3),
      host1 = Var1,
      host2 = Var1,
      infection_stage1 = as.factor(NA),
      infection_stage2 = as.factor(NA),
      resistance1 = as.factor("Susc"),
      resistance2 = as.factor("Res"),
      virus1 = as.factor(NA),
      virus2 = as.factor(NA)
    ) %>%
    select(contrast_group, bioproject, contrast, host1, host2, infection_stage1, infection_stage2, virus1, virus2, resistance1, resistance2)
  return(mat)
}

process_virus_contrast_mat <- function(this_meta) {
  bpr = unique(this_meta[["bioproject"]])
  stopifnot(all(this_meta[["bioproject"]] == bpr))

  names <- unique(as.character(this_meta[["host_tidyname"]]))
  virus <- unique(as.character(this_meta[["virus"]]))
  virus <- virus[!is.na(virus)]

  mat <- expand.grid(names, virus, virus) %>%
    filter(
      Var2 != "VF",
      Var3 == "VF"
    ) %>%
    mutate(
      bioproject = bpr,
      contrast_group = paste0(Var2, "vs", Var3),
      contrast = paste0(bpr, "_", Var1, "_", Var2, "vs", Var3),
      host1 = Var1,
      host2 = Var1,
      infection_stage1 = as.factor(NA),
      infection_stage2 = as.factor(NA),
      resistance1 = as.factor(NA),
      resistance2 = as.factor(NA),
      virus1 = as.factor(Var2),
      virus2 = as.factor(Var3)
    ) %>%
    select(contrast_group, bioproject, contrast, host1, host2, infection_stage1, infection_stage2, virus1, virus2, resistance1, resistance2)
  return(mat)
}


run_deg_tests <- function(lcounts, meta, contrasts, design, kind) {
  bpr = unique(meta[["bioproject"]])
  stopifnot(all(meta[["bioproject"]] == bpr))
  stopifnot(kind %in% c("host", "infection_stage", "resistance", "virus", "pairwise", "ipvsivtp"))

  this_counts <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = count) %>%
    column_to_rownames("id") %>%
    as.matrix()

  this_meta <- meta %>% column_to_rownames("sra") %>% .[colnames(this_counts), ]
  
  stopifnot(all(rownames(this_meta) == colnames(this_counts)))
  
  dds <- DESeqDataSetFromMatrix(
    countData = this_counts,
    colData = this_meta,
    design = design
  )

  intgroup <- as.character(design[[2]])
  intgroup <- intgroup[!intgroup %in% c("+", "-", ":", "*")]
  print(plotPCA(rlog(dds, blind = FALSE), intgroup = intgroup))

  dds_results <- DESeq(dds, test = "Wald")
  filter <- HTSFilter(dds_results, plot = TRUE, s.len=100)$filteredData
  
  # Normally i prefer to run lfcThreshold=1, but the meta analysis methods require a uniform p-value
  # distribution, and thresholded tests yield a big peak around pvalue=1.
  
  if (kind == "host") {
    meta_col <- "host_tidyname"
    contrast_col1 <- "host1"
    contrast_col2 <- "host2"
  } else if (kind == "ipvsivtp") {
    meta_col <- "ipvsivtp"
    contrast_col1 <- "host1"
    contrast_col2 <- "host2"
  } else if (kind == "infection_stage") {
    meta_col <- "infection_stage"
    contrast_col1 <- "infection_stage1"
    contrast_col2 <- "infection_stage2"
  } else if (kind == "resistance") {
    meta_col <- "resistance"
    contrast_col1 <- "resistance1"
    contrast_col2 <- "resistance2"
  } else if (kind == "virus") {
    meta_col <- "virus"
    contrast_col1 <- "virus1"
    contrast_col2 <- "virus2"
  } else if (kind == "pairwise") {
    meta_col <- "sample"
    contrast_col1 <- "sample1"
    contrast_col2 <- "sample2"
  } else {
    stop("This shouldn't happen")
  }
  
  tests <- apply(
    contrasts,
    MARGIN = 1,
    FUN = function(x) {results(filter, contrast = c(meta_col, x[contrast_col1], x[contrast_col2]), alpha = 0.01, lfcThreshold = 0, independentFiltering=FALSE)}
  )
  names(tests) <- contrasts$contrast
  
  gg <- do.call(
    rbind,
    lapply(names(tests), FUN=function(n) {data.frame(contrast=n, pvalue=tests[[n]]$pvalue)})
  ) %>%
    ggplot(aes(x=pvalue)) +
    geom_histogram() +
    facet_wrap(vars(contrast))

  print(gg)

  mapper <- function(t) {
    t2 <- as.data.frame(t) %>% summarise(
      up = sum((log2FoldChange > 0) & (padj < 0.05), na.rm = TRUE),
      down = sum((log2FoldChange < 0) & (padj < 0.05), na.rm = TRUE),
      n = n()
    )
    return(t2)
  }
  
  print(do.call(rbind, lapply(tests, mapper)))
  
  tests <- do.call(
    rbind,
    lapply(
      names(tests),
      FUN = function(n) {as.data.frame(tests[[n]]) %>% rownames_to_column("id") %>% mutate(contrast = n)}
    )
  )

  tests <- right_join(contrasts, tests, by = "contrast") %>%
    rename(baseMean = "basemean", log2FoldChange = "lfc", lfcSE = "lfc_se")
  
  if (kind == "ipvsivtp") {
    tests <- tests %>%
      mutate(host1 = as.factor(gsub("_.+$", "", host1, perl = TRUE)))
  }
  return(tests)
}

Pairwise tests

First off i’m going to run all of the pairwise tests of interest. One of the main things we’re after is invitro vs inplanta comparisons. However, we don’t have all timepoints in all experiments and the invitro samples do not usually have a time dimension, which makes marginal estimates difficult. We’ll look at the intersections between pairwise samples to decide what’s good.

Honestly there are so many tests to run that it’s hard to spend the time to describe the whole process in detail. So i’m just going to burn through some code.

pairwise_results <- list()
bpr <- "PRJNA261444"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi", "PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi", "IPvsIV",
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi", "PRJNA261444_SsclScl0205_periphery_IVPDA_stem_24hpi", "IPvsIV",
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi", "PRJNA261444_SsclScl0205_periphery_IVPDA_stem_48hpi", "IPvsIV",
  "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi", "PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi", "IPvsIV",
  "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi", "PRJNA261444_SsclScl0205_periphery_IVPDA_stem_24hpi", "IPvsIV",
  "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi", "PRJNA261444_SsclScl0205_periphery_IVPDA_stem_48hpi", "IPvsIV",
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi", "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi", "MvsE",
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi", "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi", "LvsE",
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi", "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi", "LvsE",
  "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi", "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi", "MvsERes",
  "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi", "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi", "LvsERes",
  "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi", "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi", "LvsMRes",
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi", "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi", "SuscvsRes",
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi", "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi", "SuscvsRes",
  "PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi", "PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi", "SuscvsRes"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                                                                                                                    up
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi        978
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_24hpi       1870
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_48hpi       2416
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi      796
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_24hpi     1620
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_48hpi     2380
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi      659
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi     1431
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi      557
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi  584
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi 1745
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi  894
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi      2
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi     84
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi      0
##                                                                                                                  down
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi        301
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_24hpi       1320
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_48hpi       2226
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi      246
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_24hpi     1309
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_48hpi     2288
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi      531
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi     1313
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi      352
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi  305
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi 1426
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi  614
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi      0
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi     20
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi      1
##                                                                                                                     n
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi       9012
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_24hpi       9012
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_48hpi       9012
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi     9012
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_24hpi     9012
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_48hpi     9012
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi     9012
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi     9012
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi     9012
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi 9012
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi 9012
## PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi 9012
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_12hpi   9012
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_24hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_24hpi   9012
## PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_48hpi_vs_PRJNA261444_SsclScl0205_lesion_PsatPI240515_stem_48hpi   9012
bpr <- "PRJNA327437"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi", "PRJNA327437_Sscl1980_colony_IVMMGlu", "IPvsIV",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi", "PRJNA327437_Sscl1980_colony_IVMMGlu", "IPvsIV",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi", "PRJNA327437_Sscl1980_colony_IVMMGlu", "IPvsIV",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi", "PRJNA327437_Sscl1980_colony_IVMMGlu", "IPvsIV",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi", "PRJNA327437_Sscl1980_colony_IVMMGlu", "IPvsIV",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi", "PRJNA327437_Sscl1980_colony_IVMMGlu", "IPvsIV",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi", "MvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi", "MvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi", "LvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi", "MvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi", "MvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi", "LvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi", "MvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi", "MvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi", "LvsE",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi", "LvsM",
  "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi", "PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi", "LvsM"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                                                                                                            up
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 1644
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 1578
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 1272
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                1086
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                1972
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                2188
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  1452
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  2355
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  2477
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi   885
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi  1951
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi  2240
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi   312
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi  1703
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi  2204
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi 2084
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi 1599
##                                                                                                          down
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 1420
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 1258
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                  865
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 877
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                1386
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                1551
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  1504
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  2114
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  2089
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi  1163
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi  1938
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi  2033
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi   639
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi  1632
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi  1912
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi 1707
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi 1479
##                                                                                                             n
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                 9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_colony_IVMMGlu                9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_1hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_3hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_6hpi  9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_12hpi 9509
## PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_48hpi_vs_PRJNA327437_Sscl1980_lesion_BnapDH12705_leaf_24hpi 9509
bpr <- "PRJNA341340"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA341340_Sscl1980_lesion_Slys", "PRJNA341340_Sscl1980_ball_IVPDB", "IPvsIV",
  "PRJNA341340_Sscl1980_lesion_Hann", "PRJNA341340_Sscl1980_ball_IVPDB", "IPvsIV",
  "PRJNA341340_Sscl1980_lesion_Atha", "PRJNA341340_Sscl1980_ball_IVPDB", "IPvsIV",
  "PRJNA341340_Sscl1980_lesion_Slys", "PRJNA341340_Sscl1980_lesion_Hann", "SlysvsHann",
  "PRJNA341340_Sscl1980_lesion_Slys", "PRJNA341340_Sscl1980_lesion_Atha", "SlysvsAtha",
  "PRJNA341340_Sscl1980_lesion_Hann", "PRJNA341340_Sscl1980_lesion_Slys", "HannvsSlys",
  "PRJNA341340_Sscl1980_lesion_Hann", "PRJNA341340_Sscl1980_lesion_Atha", "HannvsAtha",  
  "PRJNA341340_Sscl1980_lesion_Atha", "PRJNA341340_Sscl1980_lesion_Slys", "AthavsSlys",
  "PRJNA341340_Sscl1980_lesion_Atha", "PRJNA341340_Sscl1980_lesion_Hann", "AthavsHann",  
  "PRJNA341340_Sscl1980_sclerotia_IV", "PRJNA341340_Sscl1980_ball_IVPDB", "Sclerotial"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 520 rows containing non-finite values (`stat_bin()`).

##                                                                        up down
## PRJNA341340_Sscl1980_lesion_Slys_vs_PRJNA341340_Sscl1980_ball_IVPDB  2052 2489
## PRJNA341340_Sscl1980_lesion_Hann_vs_PRJNA341340_Sscl1980_ball_IVPDB  2445 2969
## PRJNA341340_Sscl1980_lesion_Atha_vs_PRJNA341340_Sscl1980_ball_IVPDB  1824 2405
## PRJNA341340_Sscl1980_lesion_Slys_vs_PRJNA341340_Sscl1980_lesion_Hann  726  539
## PRJNA341340_Sscl1980_lesion_Slys_vs_PRJNA341340_Sscl1980_lesion_Atha  175  316
## PRJNA341340_Sscl1980_lesion_Hann_vs_PRJNA341340_Sscl1980_lesion_Slys  539  726
## PRJNA341340_Sscl1980_lesion_Hann_vs_PRJNA341340_Sscl1980_lesion_Atha  868  918
## PRJNA341340_Sscl1980_lesion_Atha_vs_PRJNA341340_Sscl1980_lesion_Slys  316  175
## PRJNA341340_Sscl1980_lesion_Atha_vs_PRJNA341340_Sscl1980_lesion_Hann  918  868
## PRJNA341340_Sscl1980_sclerotia_IV_vs_PRJNA341340_Sscl1980_ball_IVPDB 2920 3254
##                                                                         n
## PRJNA341340_Sscl1980_lesion_Slys_vs_PRJNA341340_Sscl1980_ball_IVPDB  9688
## PRJNA341340_Sscl1980_lesion_Hann_vs_PRJNA341340_Sscl1980_ball_IVPDB  9688
## PRJNA341340_Sscl1980_lesion_Atha_vs_PRJNA341340_Sscl1980_ball_IVPDB  9688
## PRJNA341340_Sscl1980_lesion_Slys_vs_PRJNA341340_Sscl1980_lesion_Hann 9688
## PRJNA341340_Sscl1980_lesion_Slys_vs_PRJNA341340_Sscl1980_lesion_Atha 9688
## PRJNA341340_Sscl1980_lesion_Hann_vs_PRJNA341340_Sscl1980_lesion_Slys 9688
## PRJNA341340_Sscl1980_lesion_Hann_vs_PRJNA341340_Sscl1980_lesion_Atha 9688
## PRJNA341340_Sscl1980_lesion_Atha_vs_PRJNA341340_Sscl1980_lesion_Slys 9688
## PRJNA341340_Sscl1980_lesion_Atha_vs_PRJNA341340_Sscl1980_lesion_Hann 9688
## PRJNA341340_Sscl1980_sclerotia_IV_vs_PRJNA341340_Sscl1980_ball_IVPDB 9688
bpr <- "PRJNA418121"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA418121_Sscl1980_periphery_AthaCol0_leaf_50hpi", "PRJNA418121_Sscl1980_periphery_SlysHeinz_leaf_50hpi", "AthavsSlys",
  "PRJNA418121_Sscl1980_periphery_SlysHeinz_leaf_50hpi", "PRJNA418121_Sscl1980_periphery_AthaCol0_leaf_50hpi", "SlysvsAtha"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 4 rows containing non-finite values (`stat_bin()`).

##                                                                                                            up
## PRJNA418121_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA418121_Sscl1980_periphery_SlysHeinz_leaf_50hpi 755
## PRJNA418121_Sscl1980_periphery_SlysHeinz_leaf_50hpi_vs_PRJNA418121_Sscl1980_periphery_AthaCol0_leaf_50hpi 690
##                                                                                                           down
## PRJNA418121_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA418121_Sscl1980_periphery_SlysHeinz_leaf_50hpi  690
## PRJNA418121_Sscl1980_periphery_SlysHeinz_leaf_50hpi_vs_PRJNA418121_Sscl1980_periphery_AthaCol0_leaf_50hpi  755
##                                                                                                              n
## PRJNA418121_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA418121_Sscl1980_periphery_SlysHeinz_leaf_50hpi 8023
## PRJNA418121_Sscl1980_periphery_SlysHeinz_leaf_50hpi_vs_PRJNA418121_Sscl1980_periphery_AthaCol0_leaf_50hpi 8023
bpr <- "PRJNA471709"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_48hpi", "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi", "MvsERes",
  "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi", "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi", "LvsERes",
  "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi", "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_48hpi", "LvsMRes",
  "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi", "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi", "MvsE",
  "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi", "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi", "LvsE",
  "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi", "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi", "LvsM",
  "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi", "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi", "SuscvsResE",
  "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi", "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi", "SuscvsRes",
  "PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi", "PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi", "SuscvsRes"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 378 rows containing non-finite values (`stat_bin()`).

##                                                                                                       up
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi 454
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi 943
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_48hpi 265
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi   376
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi   714
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi   139
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi    4
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi  291
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi  290
##                                                                                                      down
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi  323
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi  721
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_48hpi  174
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi    172
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi    569
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi    160
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi     4
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi   233
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi   333
##                                                                                                         n
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi 9248
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi 9248
## PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_48hpi 9248
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi   9248
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi   9248
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi   9248
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_24hpi  9248
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi  9248
## PRJNA471709_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA471709_Sscl1980_lesion_Gmax91145_stem_96hpi  9248
bpr <- "PRJNA477716"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi", "PRJNA477716_Sscl1980_ball_IVPDB_96hpi", "IPvsIV",
  "PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi", "PRJNA477716_Sscl1980_ball_IVMM_96hpi", "IPvsIV",
  "PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi", "PRJNA477716_Sscl1980_periphery_IVPDA_48hpi", "IPvsIV",
  "PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi", "PRJNA477716_Sscl1980_center_IVPDA_48hpi", "IPvsIV"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 232 rows containing non-finite values (`stat_bin()`).

##                                                                                                 up
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_ball_IVPDB_96hpi      2170
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_ball_IVMM_96hpi       3236
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_periphery_IVPDA_48hpi 2359
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_center_IVPDA_48hpi    2139
##                                                                                               down
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_ball_IVPDB_96hpi      2792
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_ball_IVMM_96hpi       3200
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_periphery_IVPDA_48hpi 2150
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_center_IVPDA_48hpi    2246
##                                                                                                  n
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_ball_IVPDB_96hpi      9828
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_ball_IVMM_96hpi       9828
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_periphery_IVPDA_48hpi 9828
## PRJNA477716_Sscl1980_center_AthaCol0_leaf_48hpi_vs_PRJNA477716_Sscl1980_center_IVPDA_48hpi    9828
bpr <- "PRJNA501892"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi", "PRJNA501892_Sscl1980_colony_IVPDA", "IPvsIV",
  "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi", "PRJNA501892_Sscl1980_colony_IVPDA", "IPvsIV",
  "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi", "PRJNA501892_Sscl1980_colony_IVPDA", "IPvsIV",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi", "PRJNA501892_Sscl1980_colony_IVPDA", "IPvsIV",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi", "PRJNA501892_Sscl1980_colony_IVPDA", "IPvsIV",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi", "PRJNA501892_Sscl1980_colony_IVPDA", "IPvsIV",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi", "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi", "SuscvsResE",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi", "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi", "SuscvsRes",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi", "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi", "SuscvsRes",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi", "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi", "MvsE",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi", "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi", "LvsE",
  "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi", "PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi", "LvsM",
  "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi", "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi", "MvsERes",
  "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi", "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi", "LvsERes",
  "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi", "PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi", "LvsMRes"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 495 rows containing non-finite values (`stat_bin()`).

##                                                                                                        up
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                1875
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                1849
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                2234
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 1897
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 1803
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 2071
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi     1
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi     4
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi   380
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi    408
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi    800
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi    166
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi  479
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi  995
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi  317
##                                                                                                      down
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                1589
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                1385
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                1794
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 1640
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 1290
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 1773
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi     4
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi     4
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi   417
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi    210
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi    649
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi    186
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi  388
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi  782
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi  206
##                                                                                                         n
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                9294
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                9294
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_colony_IVPDA                 9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi  9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi  9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi  9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi   9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_24hpi   9294
## PRJNA501892_Sscl1980_lesion_Gmax9144_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax9144_stem_48hpi   9294
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi 9294
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_24hpi 9294
## PRJNA501892_Sscl1980_lesion_Gmax91145_stem_96hpi_vs_PRJNA501892_Sscl1980_lesion_Gmax91145_stem_48hpi 9294
bpr <- "PRJNA516496"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi", "PRJNA516496_SsclCU824_ball_IVPDB", "IPvsIV",
  "PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi", "PRJNA516496_SsclCU824_ball_IVPDB", "IPvsIV",
  "PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi", "PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi", "LangvsBnap",
  "PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi", "PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi", "BnapvsLang"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 768 rows containing non-finite values (`stat_bin()`).

##                                                                                                             up
## PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi_vs_PRJNA516496_SsclCU824_ball_IVPDB                    1673
## PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi_vs_PRJNA516496_SsclCU824_ball_IVPDB                   1742
## PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi_vs_PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi   65
## PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi_vs_PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi  135
##                                                                                                           down
## PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi_vs_PRJNA516496_SsclCU824_ball_IVPDB                    1746
## PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi_vs_PRJNA516496_SsclCU824_ball_IVPDB                   1870
## PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi_vs_PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi  135
## PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi_vs_PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi   65
##                                                                                                              n
## PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi_vs_PRJNA516496_SsclCU824_ball_IVPDB                    9584
## PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi_vs_PRJNA516496_SsclCU824_ball_IVPDB                   9584
## PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi_vs_PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi 9584
## PRJNA516496_SsclCU824_lesion_BnapCobbler_stem_72hpi_vs_PRJNA516496_SsclCU824_lesion_LangTanjil_stem_72hpi 9584
bpr <- "PRJNA574280"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi", "PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi", "HannvsPvul",
  "PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi", "PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi", "BvulvulvsPvul",
  "PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi", "PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi", "RcomvsPvul",
  "PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi", "PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi", "PvulvsHann",
  "PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi", "PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi", "BvulvulvsHann",
  "PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi", "PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi", "RcomvsHann",
  "PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi", "PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi", "PvulvsBvulvul",
  "PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi", "PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi", "HannvsBvulvul",
  "PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi", "PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi", "RcomvsBvulvul",
  "PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi", "PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi", "PvulvsRcom",
  "PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi", "PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi", "HannvsRcom",
  "PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi", "PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi", "BvulvulvsRcom"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 576 rows containing non-finite values (`stat_bin()`).

##                                                                                                             up
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi  841
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi  921
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi    1587
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi 1181
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi    2523
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi       2520
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi  618
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi    1960
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi       2060
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi    1643
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi       2085
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi       2343
##                                                                                                           down
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi 1181
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi  618
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi    1643
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi  841
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi    1960
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi       2085
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi  921
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi    2523
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi       2343
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi    1587
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi       2520
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi       2060
##                                                                                                              n
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi 9086
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi 9086
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi    9086
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi 9086
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi    9086
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi       9086
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi 9086
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi    9086
## PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi       9086
## PRJNA574280_Sscl1980_periphery_PvulG19833_leaf_50hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi    9086
## PRJNA574280_Sscl1980_periphery_HannXRQ_leaf_24hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi       9086
## PRJNA574280_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA574280_Sscl1980_periphery_Rcom_leaf_50hpi       9086
bpr <- "PRJNA577619"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_12hpi", "PRJNA577619_SsclDT8_surface_hyphae_Bnap_12hpi", "SsHADVvsVF",
  "PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_24hpi", "PRJNA577619_SsclDT8_surface_hyphae_Bnap_24hpi", "SsHADVvsVF",
  "PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_18hpi", "PRJNA577619_SsclDT8_surface_hyphae_Bnap_18hpi", "SsHADVvsVF"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (`stat_bin()`).

##                                                                                                        up
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_12hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_12hpi 2766
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_24hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_24hpi 2832
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_18hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_18hpi 2828
##                                                                                                      down
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_12hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_12hpi 2985
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_24hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_24hpi 2816
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_18hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_18hpi 3035
##                                                                                                         n
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_12hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_12hpi 8696
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_24hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_24hpi 8696
## PRJNA577619_SsclDT8SsHADV_surface_hyphae_Bnap_18hpi_vs_PRJNA577619_SsclDT8_surface_hyphae_Bnap_18hpi 8696
bpr <- "PRJNA593737"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA593737_SsclZ113OXSsNSRV1_colony_IVPDA", "PRJNA593737_Sscl1980_colony_IVPDA", "SsNRSVvsVF",
  "PRJNA593737_SsclZ11OXSsNSRV1_colony_IVPDA", "PRJNA593737_Sscl1980_colony_IVPDA", "SsNRSVvsVF",
  "PRJNA593737_SsclAH98_colony_IVPDA", "PRJNA593737_Sscl1980_colony_IVPDA", "SsNRSVSsHVvsVF"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 30 rows containing non-finite values (`stat_bin()`).

##                                                                                   up
## PRJNA593737_SsclZ113OXSsNSRV1_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA  670
## PRJNA593737_SsclZ11OXSsNSRV1_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA  2641
## PRJNA593737_SsclAH98_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA          2716
##                                                                                 down
## PRJNA593737_SsclZ113OXSsNSRV1_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA 1218
## PRJNA593737_SsclZ11OXSsNSRV1_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA  2730
## PRJNA593737_SsclAH98_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA          2933
##                                                                                    n
## PRJNA593737_SsclZ113OXSsNSRV1_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA 8809
## PRJNA593737_SsclZ11OXSsNSRV1_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA  8809
## PRJNA593737_SsclAH98_colony_IVPDA_vs_PRJNA593737_Sscl1980_colony_IVPDA          8809
bpr <- "PRJNA603456"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA603456_SsclMBGSs2_colony_IVPDAindol3carbinol", "PRJNA603456_SsclMBGSs2_colony_IVPDA", "none",
  "PRJNA603456_SsclMBGSs2_colony_IVPDAallylisothiocyanate", "PRJNA603456_SsclMBGSs2_colony_IVPDA", "none"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                                                                                                up
## PRJNA603456_SsclMBGSs2_colony_IVPDAindol3carbinol_vs_PRJNA603456_SsclMBGSs2_colony_IVPDA       52
## PRJNA603456_SsclMBGSs2_colony_IVPDAallylisothiocyanate_vs_PRJNA603456_SsclMBGSs2_colony_IVPDA 431
##                                                                                               down
## PRJNA603456_SsclMBGSs2_colony_IVPDAindol3carbinol_vs_PRJNA603456_SsclMBGSs2_colony_IVPDA       129
## PRJNA603456_SsclMBGSs2_colony_IVPDAallylisothiocyanate_vs_PRJNA603456_SsclMBGSs2_colony_IVPDA  468
##                                                                                                  n
## PRJNA603456_SsclMBGSs2_colony_IVPDAindol3carbinol_vs_PRJNA603456_SsclMBGSs2_colony_IVPDA      8981
## PRJNA603456_SsclMBGSs2_colony_IVPDAallylisothiocyanate_vs_PRJNA603456_SsclMBGSs2_colony_IVPDA 8981
bpr <- "PRJNA607858"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA607858_Sscl_lesion_AthaCol0Ago21_leaf_8hpi", "PRJNA607858_Sscl_lesion_AthaCol0_leaf_8hpi", "none"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                                                                                               up
## PRJNA607858_Sscl_lesion_AthaCol0Ago21_leaf_8hpi_vs_PRJNA607858_Sscl_lesion_AthaCol0_leaf_8hpi  1
##                                                                                               down
## PRJNA607858_Sscl_lesion_AthaCol0Ago21_leaf_8hpi_vs_PRJNA607858_Sscl_lesion_AthaCol0_leaf_8hpi    8
##                                                                                                  n
## PRJNA607858_Sscl_lesion_AthaCol0Ago21_leaf_8hpi_vs_PRJNA607858_Sscl_lesion_AthaCol0_leaf_8hpi 7840
bpr <- "PRJNA641217"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA641217_SsclDT8_lesion_Bnap_hypocotyl", "PRJNA641217_SsclDT8_colony_IVPDA", "IPvsIV",
  "PRJNA641217_SsclDT8SsHADV_lesion_Bnap_hypocotyl", "PRJNA641217_SsclDT8SsHADV_colony_IVPDA", "none",
  "PRJNA641217_SsclDT8SsHADV_colony_IVPDA", "PRJNA641217_SsclDT8_colony_IVPDA", "SsHADVvsVF",
  "PRJNA641217_SsclDT8SsHADV_lesion_Bnap_hypocotyl", "PRJNA641217_SsclDT8_lesion_Bnap_hypocotyl", "SsHADVvsVF"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 28 rows containing non-finite values (`stat_bin()`).

##                                                                                                up
## PRJNA641217_SsclDT8_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8_colony_IVPDA                2213
## PRJNA641217_SsclDT8SsHADV_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8SsHADV_colony_IVPDA    2096
## PRJNA641217_SsclDT8SsHADV_colony_IVPDA_vs_PRJNA641217_SsclDT8_colony_IVPDA                   2959
## PRJNA641217_SsclDT8SsHADV_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8_lesion_Bnap_hypocotyl 2698
##                                                                                              down
## PRJNA641217_SsclDT8_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8_colony_IVPDA                2197
## PRJNA641217_SsclDT8SsHADV_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8SsHADV_colony_IVPDA    2092
## PRJNA641217_SsclDT8SsHADV_colony_IVPDA_vs_PRJNA641217_SsclDT8_colony_IVPDA                   2996
## PRJNA641217_SsclDT8SsHADV_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8_lesion_Bnap_hypocotyl 2558
##                                                                                                 n
## PRJNA641217_SsclDT8_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8_colony_IVPDA                8906
## PRJNA641217_SsclDT8SsHADV_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8SsHADV_colony_IVPDA    8906
## PRJNA641217_SsclDT8SsHADV_colony_IVPDA_vs_PRJNA641217_SsclDT8_colony_IVPDA                   8906
## PRJNA641217_SsclDT8SsHADV_lesion_Bnap_hypocotyl_vs_PRJNA641217_SsclDT8_lesion_Bnap_hypocotyl 8906
bpr <- "PRJNA641462"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA641462_SsclDT8SsHADV_lesion_BnapHuashaung4_hypocotyl", "PRJNA641462_SsclDT8_lesion_BnapHuashaung4_hypocotyl", "SsHADVvsVF"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                                                                                                                    up
## PRJNA641462_SsclDT8SsHADV_lesion_BnapHuashaung4_hypocotyl_vs_PRJNA641462_SsclDT8_lesion_BnapHuashaung4_hypocotyl 2192
##                                                                                                                  down
## PRJNA641462_SsclDT8SsHADV_lesion_BnapHuashaung4_hypocotyl_vs_PRJNA641462_SsclDT8_lesion_BnapHuashaung4_hypocotyl 2003
##                                                                                                                     n
## PRJNA641462_SsclDT8SsHADV_lesion_BnapHuashaung4_hypocotyl_vs_PRJNA641462_SsclDT8_lesion_BnapHuashaung4_hypocotyl 8513
bpr <- "PRJNA643804"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  "PRJNA643804_SsclDK3SlaGemV1_cellophane_colony_IVPDACellophane", "PRJNA643804_SsclDK3_cellophane_colony_IVPDACellophane", "SlaGemV1vsVF"
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 15 rows containing non-finite values (`stat_bin()`).

##                                                                                                                          up
## PRJNA643804_SsclDK3SlaGemV1_cellophane_colony_IVPDACellophane_vs_PRJNA643804_SsclDK3_cellophane_colony_IVPDACellophane 1902
##                                                                                                                        down
## PRJNA643804_SsclDK3SlaGemV1_cellophane_colony_IVPDACellophane_vs_PRJNA643804_SsclDK3_cellophane_colony_IVPDACellophane 1854
##                                                                                                                           n
## PRJNA643804_SsclDK3SlaGemV1_cellophane_colony_IVPDACellophane_vs_PRJNA643804_SsclDK3_cellophane_colony_IVPDACellophane 9718
bpr <- "PRJNA670487"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_ball_IVPDB', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_colony_IVPDA_DMSO', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_periphery_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_periphery_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_center_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_center_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_center_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_center_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_center_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_center_IVPDA', 'IPvsIV',
  'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'SlysvsAtha',
  'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'HannvsAtha',
  'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'BvulvulvsAtha',
  'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'RcomvsAtha',
  'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PvulvsAtha',
  'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'AthavsSlys',
  'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'HannvsSlys',
  'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'BvulvulvsSlys',
  'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'RcomvsSlys',
  'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PvulvsSlys',
  'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'AthavsHann',
  'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'SlysvsHann',
  'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'BvulvulvsHann',
  'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'RcomvsHann',
  'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PvulvsHann',
  'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'AthavsBvulvul',
  'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'SlysvsBvulvul',
  'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'HannvsBvulvul',
  'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'RcomvsBvulvul',
  'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PvulvsBvulvul',
  'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'AthavsRcom',
  'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'SlysvsRcom',
  'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'HannvsRcom',
  'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'BvulvulvsRcom',
  'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PvulvsRcom',
  'PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'AthavsPvul',
  'PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'SlysvsPvul',
  'PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'HannvsPvul',
  'PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'BvulvulvsPvul',
  'PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi', 'RcomvsPvul',
  'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'SlysvsAtha',
  'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'HannvsAtha',
  'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'BvulvulvsAtha',
  'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'RcomvsAtha',
  'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PvulvsAtha',
  'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'AthavsSlys',
  'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'HannvsSlys',
  'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'BvulvulvsSlys',
  'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'RcomvsSlys',
  'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PvulvsSlys',
  'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'AthavsHann',
  'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'SlysvsHann',
  'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'BvulvulvsHann',
  'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'RcomvsHann',
  'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PvulvsHann',
  'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'AthavsBvulvul',
  'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'SlysvsBvulvul',
  'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'HannvsBvulvul',
  'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'RcomvsBvulvul',
  'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PvulvsBvulvul',
  'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'AthavsRcom',
  'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'SlysvsRcom',
  'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'HannvsRcom',
  'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'BvulvulvsRcom',
  'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PvulvsRcom',
  'PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'AthavsPvul',
  'PRJNA670487_Sscl1980_center_Slys_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'SlysvsPvul',
  'PRJNA670487_Sscl1980_center_Hann_leaf_24hpi', 'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'HannvsPvul',
  'PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi', 'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'BvulvulvsPvul',
  'PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi', 'PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi', 'RcomvsPvul'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 384 rows containing non-finite values (`stat_bin()`).

##                                                                                                           up
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                   1578
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                      1575
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       1710
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          1566
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       1987
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          2705
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                    2159
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       2170
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       2673
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          2478
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       1745
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          1869
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO            1113
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO               1900
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                1009
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   1656
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                1020
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   2806
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO             2469
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                2709
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                2782
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   2701
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                1535
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   2204
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA              1646
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  1468
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  1043
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA               3063
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  3036
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  2021
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                    1615
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        1715
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        2549
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                     3064
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        2747
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        2382
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi      95
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi     399
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi 1781
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi    2343
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi     496
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi     236
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi         211
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi     1826
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi        2292
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi         592
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi     782
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi         565
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi     2737
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi        2823
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi        1297
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi 1284
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     1354
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     2006
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     2179
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi      880
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi    2088
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        1950
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        2165
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi     2424
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        1725
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi     318
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi         281
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi         688
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi     1075
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi        1752
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi           135
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          2248
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi       2149
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          2049
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          1000
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi           157
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi              2070
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi           1517
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi              1769
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi               532
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi          2453
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              2310
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi           3503
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              2088
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              2790
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi       1432
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi            936
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           2437
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           1970
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi            279
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi          1982
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              1712
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              1630
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi           2384
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              1619
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi           458
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi               155
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi              2063
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi            409
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi              1407
##                                                                                                         down
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                   2508
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                      2468
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       2632
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          2367
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       3195
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          3617
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                    2587
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       2280
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       3318
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          3229
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       2343
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          2198
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO             864
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO               1721
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                 856
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   1332
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                1280
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   2777
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO             2013
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                1975
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                2419
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   2600
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                1015
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   1551
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA              1605
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  1406
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  1024
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA               2567
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  2634
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  1861
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                    1628
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        1632
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        2541
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                     2512
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        2913
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        2143
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi     236
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi     782
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi 1284
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi    2088
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi     318
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi      95
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi         565
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi     1354
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi        1950
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi         281
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi     399
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi         211
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi     2006
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi        2165
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi         688
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi 1781
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     1826
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     2737
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     2424
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     1075
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi    2343
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        2292
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        2823
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi     2179
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        1752
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi     496
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi         592
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi        1297
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi      880
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi        1725
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi           157
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          2453
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi       1432
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          1982
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi           458
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi           135
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi              2310
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi            936
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi              1712
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi               155
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi          2248
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              2070
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi           2437
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              1630
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              2063
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi       2149
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           1517
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           3503
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           2384
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi            409
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi          2049
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              1769
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              2088
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi           1970
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              1407
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi          1000
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi               532
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi              2790
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi            279
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi              1619
##                                                                                                            n
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                   9671
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                      9671
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       9671
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          9671
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       9671
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          9671
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                    9671
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       9671
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       9671
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          9671
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                       9671
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_ball_IVPDB                          9671
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO            9671
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO               9671
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                9671
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   9671
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                9671
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   9671
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO             9671
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                9671
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                9671
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   9671
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                9671
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_colony_IVPDA_DMSO                   9671
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA              9671
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  9671
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  9671
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA               9671
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  9671
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_IVPDA                  9671
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                    9671
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        9671
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        9671
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                     9671
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        9671
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_IVPDA                        9671
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi    9671
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi    9671
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi 9671
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi    9671
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi    9671
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi    9671
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi        9671
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi     9671
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi        9671
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi        9671
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi    9671
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi        9671
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi     9671
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi        9671
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi        9671
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi 9671
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     9671
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     9671
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     9671
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi     9671
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi    9671
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        9671
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        9671
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi     9671
## PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi        9671
## PRJNA670487_Sscl1980_periphery_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi    9671
## PRJNA670487_Sscl1980_periphery_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi        9671
## PRJNA670487_Sscl1980_periphery_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi        9671
## PRJNA670487_Sscl1980_periphery_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi     9671
## PRJNA670487_Sscl1980_periphery_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_periphery_Pvul_leaf_50hpi        9671
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          9671
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          9671
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi       9671
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          9671
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi          9671
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi          9671
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi              9671
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi           9671
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi              9671
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Slys_leaf_50hpi              9671
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi          9671
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              9671
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi           9671
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              9671
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Hann_leaf_24hpi              9671
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi       9671
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           9671
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           9671
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           9671
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi           9671
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi          9671
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              9671
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              9671
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi           9671
## PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi              9671
## PRJNA670487_Sscl1980_center_AthaCol0_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi          9671
## PRJNA670487_Sscl1980_center_Slys_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi              9671
## PRJNA670487_Sscl1980_center_Hann_leaf_24hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi              9671
## PRJNA670487_Sscl1980_center_Bvulvul_leaf_72hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi           9671
## PRJNA670487_Sscl1980_center_Rcom_leaf_50hpi_vs_PRJNA670487_Sscl1980_center_Pvul_leaf_50hpi              9671
bpr <- "PRJNA687280"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi', 'PRJNA687280_SsclCU820_ball_IVPDB', 'IPvsIV',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi', 'SuscvsResE',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi', 'SuscvsResE',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi', 'SuscvsRes',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi', 'SuscvsRes',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi', 'MvsERes',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi', 'MvsERes',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi', 'LvsERes',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi', 'MvsERes',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi', 'MvsERes',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi', 'LvsERes',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi', 'LvsMRes',
  'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi', 'PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi', 'LvsMRes',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi', 'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi', 'MvsE',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi', 'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi', 'MvsE',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi', 'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi', 'LvsE',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi', 'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi', 'MvsE',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi', 'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi', 'MvsE',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi', 'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi', 'LvsE',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi', 'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi', 'LvsM',
  'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi', 'PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi', 'LvsM'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 90 rows containing non-finite values (`stat_bin()`).

##                                                                                                                up
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                      2979
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     3199
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     3098
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     3605
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     3397
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       3651
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       3366
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       3084
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       3099
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                        2817
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi      403
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi    148
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi     23
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi     93
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  1832
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  2461
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  2170
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 1606
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 2811
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 2346
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi 2432
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi    1
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      1185
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      1276
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      1811
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     1851
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     1769
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     2218
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi     3391
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi      350
##                                                                                                              down
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                      4106
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     4383
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     4731
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     4042
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     4246
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       4137
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       4307
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       4707
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       4210
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                        3618
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi      289
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi    170
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi     10
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi    435
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  2268
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  1951
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  1891
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 2132
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 2164
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 2012
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi 1448
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi    6
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      1447
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      1156
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      1556
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     2188
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     1632
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     1699
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi     2097
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi      114
##                                                                                                                 n
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                      9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                     9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                       9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi_vs_PRJNA687280_SsclCU820_ball_IVPDB                        9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi     9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi   9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi   9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi   9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_6hpi  9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_12hpi 9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_24hpi 9856
## PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariHatTrick_stem_48hpi 9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_6hpi      9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_12hpi     9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_24hpi     9856
## PRJNA687280_SsclCU820_lesion_CariKyabra_stem_72hpi_vs_PRJNA687280_SsclCU820_lesion_CariKyabra_stem_48hpi     9856
bpr <- "PRJNA695466"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  'PRJNA695466_SsclDT8SsHADV_colony_IVPDA', 'PRJNA695466_SsclDT8_colony_IVPDA', 'SsHADVvsVF'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 3 rows containing non-finite values (`stat_bin()`).

##                                                                              up
## PRJNA695466_SsclDT8SsHADV_colony_IVPDA_vs_PRJNA695466_SsclDT8_colony_IVPDA 3154
##                                                                            down
## PRJNA695466_SsclDT8SsHADV_colony_IVPDA_vs_PRJNA695466_SsclDT8_colony_IVPDA 3205
##                                                                               n
## PRJNA695466_SsclDT8SsHADV_colony_IVPDA_vs_PRJNA695466_SsclDT8_colony_IVPDA 8855
bpr <- "PRJNA706136"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  'PRJNA706136_Sscl_lesion_Bole_petiole_8hpi', 'PRJNA706136_Sscl_lesion_Bvil_petiole_8hpi', 'BolevsBvil',
  'PRJNA706136_Sscl_lesion_Bvil_petiole_8hpi', 'PRJNA706136_Sscl_lesion_Bole_petiole_8hpi', 'BvilvsBole'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                                                                                         up
## PRJNA706136_Sscl_lesion_Bole_petiole_8hpi_vs_PRJNA706136_Sscl_lesion_Bvil_petiole_8hpi  85
## PRJNA706136_Sscl_lesion_Bvil_petiole_8hpi_vs_PRJNA706136_Sscl_lesion_Bole_petiole_8hpi 283
##                                                                                        down
## PRJNA706136_Sscl_lesion_Bole_petiole_8hpi_vs_PRJNA706136_Sscl_lesion_Bvil_petiole_8hpi  283
## PRJNA706136_Sscl_lesion_Bvil_petiole_8hpi_vs_PRJNA706136_Sscl_lesion_Bole_petiole_8hpi   85
##                                                                                           n
## PRJNA706136_Sscl_lesion_Bole_petiole_8hpi_vs_PRJNA706136_Sscl_lesion_Bvil_petiole_8hpi 7197
## PRJNA706136_Sscl_lesion_Bvil_petiole_8hpi_vs_PRJNA706136_Sscl_lesion_Bole_petiole_8hpi 7197
bpr <- "PRJNA735329"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  'PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_24hpi', 'PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_6hpi', 'MvsERes',
  'PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_48hpi', 'PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_6hpi', 'LvsERes',
  'PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_48hpi', 'PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_24hpi', 'LvsMRes'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (`stat_bin()`).

##                                                                                                            up
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_24hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_6hpi  1168
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_48hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_6hpi  1695
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_48hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_24hpi 1088
##                                                                                                          down
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_24hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_6hpi   921
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_48hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_6hpi  1283
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_48hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_24hpi  811
##                                                                                                             n
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_24hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_6hpi  8993
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_48hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_6hpi  8993
## PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_48hpi_vs_PRJNA735329_Sscl1980_lesion_BnapNingRS1_leaf_24hpi 8993
bpr <- "PRJNA766564"
this_meta <- meta %>% filter(bioproject == bpr, sra != "SRR16082437")
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
   'PRJNA766564_Sscl_lesion_BnapWestar_stem_168hpi', 'PRJNA766564_Sscl_lesion_BnapWestar_stem_24hpi', 'LvsE',
   'PRJNA766564_Sscl_lesion_BnapWestar_stem_168hpi', 'PRJNA766564_Sscl_lesion_Bnap1703_stem_168hpi', 'SuscvsRes'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                                                                                                   up
## PRJNA766564_Sscl_lesion_BnapWestar_stem_168hpi_vs_PRJNA766564_Sscl_lesion_BnapWestar_stem_24hpi 1352
## PRJNA766564_Sscl_lesion_BnapWestar_stem_168hpi_vs_PRJNA766564_Sscl_lesion_Bnap1703_stem_168hpi     6
##                                                                                                 down
## PRJNA766564_Sscl_lesion_BnapWestar_stem_168hpi_vs_PRJNA766564_Sscl_lesion_BnapWestar_stem_24hpi  914
## PRJNA766564_Sscl_lesion_BnapWestar_stem_168hpi_vs_PRJNA766564_Sscl_lesion_Bnap1703_stem_168hpi     1
##                                                                                                    n
## PRJNA766564_Sscl_lesion_BnapWestar_stem_168hpi_vs_PRJNA766564_Sscl_lesion_BnapWestar_stem_24hpi 8776
## PRJNA766564_Sscl_lesion_BnapWestar_stem_168hpi_vs_PRJNA766564_Sscl_lesion_Bnap1703_stem_168hpi  8776
bpr <- "PRJNA777355"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi', 'PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane', 'IPvsIV',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi', 'PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane', 'IPvsIV',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi', 'PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane', 'IPvsIV',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi', 'PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane', 'IPvsIV',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi', 'PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane', 'IPvsIV',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi', 'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi', 'MvsE',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi', 'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi', 'MvsE',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi', 'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi', 'MvsE',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi', 'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi', 'MvsE',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi', 'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi', 'MvsE',
  'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi', 'PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi', 'MvsE'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 22 rows containing non-finite values (`stat_bin()`).

##                                                                                                               up
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane  2909
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane  3855
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 2973
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 2493
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 3508
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       2236
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       2522
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       3416
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       3406
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       3570
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       3399
##                                                                                                             down
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane  2551
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane  3637
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 2949
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 2743
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 2957
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       1935
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       2576
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       3292
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       3492
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       3662
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       3343
##                                                                                                                n
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane  9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane  9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_cellophane_colony_IVPDACellophane 9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_2hpi       9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_12hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_24hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       9207
## PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_36hpi_vs_PRJNA777355_Sscl1980_lesion_BnapWestar_leaf_6hpi       9207
bpr <- "PRJNA789389"
this_meta <- meta %>% filter(bioproject == bpr, sra != "SRR17267260")
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  'PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_4hpi', 'PRJNA789389_SsclNB5_ball_IVCYM', 'IPvsIV',
  'PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_8hpi', 'PRJNA789389_SsclNB5_ball_IVCYM', 'IPvsIV',
  'PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_8hpi', 'PRJNA789389_SsclNB5_ball_IVCYM', 'IPvsIV',
  'PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_8hpi', 'PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_8hpi', 'SuscvsResE'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 800 rows containing non-finite values (`stat_bin()`).

##                                                                                                              up
## PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_4hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                     1489
## PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_8hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                     1780
## PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_8hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                       1822
## PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_8hpi_vs_PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_8hpi    0
##                                                                                                            down
## PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_4hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                     1597
## PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_8hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                     1880
## PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_8hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                       1773
## PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_8hpi_vs_PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_8hpi    2
##                                                                                                               n
## PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_4hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                     9605
## PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_8hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                     9605
## PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_8hpi_vs_PRJNA789389_SsclNB5_ball_IVCYM                       9605
## PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_8hpi_vs_PRJNA789389_SsclNB5_lesion_GmaxACColibriOA_leaf_8hpi 9605
bpr <- "PRJNA804213"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

# These don't have phenotypes that I can find, so no contrasts
# PRJNA804213_SsclP7_lesion_LsatPI251246_leaf_42hpi
# PRJNA804213_SsclP7_lesion_LsatArmenianLser_leaf_42hpi
# PRJNA804213_SsclP7_lesion_Lsat43_leaf_42hpi

contrasts <- matrix(c(
  'PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes',
  'PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi', 'PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi', 'SuscvsRes'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## rlog() may take a long time with 50 or more samples,
## vst() is a much faster transformation
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 56 rows containing non-finite values (`stat_bin()`).

##                                                                                                                         up
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                  3
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                           0
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                      0
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                      8
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi          0
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                        29
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                  1
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                0
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                  12
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                  25
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                           0
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                      0
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                      2
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi           19
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                42
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                        100
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                     1
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                   605
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi         1
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                      558
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                 7
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi               2
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                 43
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                194
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                         12
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                     1
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                     1
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi         192
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi          12
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                   11
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi               0
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi             583
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi   1
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                596
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi           2
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi         1
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi            6
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi           35
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                    2
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi               1
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi               1
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi    36
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                   0
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                            0
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                       0
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                       2
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi           0
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                          2
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                   0
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                 3
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                    0
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                    0
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                            2
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                       1
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                       0
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi             2
##                                                                                                                        down
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                  53
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                           32
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                      26
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                     287
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi           0
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                        310
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                  20
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                35
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                  141
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                  128
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                           85
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                      15
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                      21
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi           123
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                193
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                         196
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                     19
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                    668
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi          7
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                       657
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                 26
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi               17
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                 247
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                 366
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                         143
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                      1
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                      7
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi          304
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi          101
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                    92
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                0
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi              590
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi    0
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                 561
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi            0
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi          0
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi           118
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi           135
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                    19
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                1
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                0
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi    119
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                    0
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                             0
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                        1
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                        8
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi            1
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                          41
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                    0
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                  1
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                     6
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                     0
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                             6
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                        1
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                        0
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi              5
##                                                                                                                           n
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                8986
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                         8986
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                    8986
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                    8986
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi        8986
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                       8986
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                8986
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi              8986
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                 8986
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                 8986
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                         8986
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                    8986
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi                    8986
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatPrazan_leaf_42hpi          8986
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi               8986
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                        8986
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                   8986
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                   8986
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi       8986
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                      8986
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi               8986
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi             8986
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                8986
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                8986
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                        8986
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                   8986
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi                   8986
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatIceberg_leaf_42hpi         8986
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi         8986
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                  8986
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi             8986
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi             8986
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi 8986
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                8986
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi         8986
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi       8986
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi          8986
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi          8986
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi                  8986
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi             8986
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi             8986
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatBataviaTezier_leaf_42hpi   8986
## PRJNA804213_SsclP7_lesion_LsatRedGranoble_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                 8986
## PRJNA804213_SsclP7_lesion_Lsat58_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                          8986
## PRJNA804213_SsclP7_lesion_LsatPallone_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                     8986
## PRJNA804213_SsclP7_lesion_LsatOakLeaf_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                     8986
## PRJNA804213_SsclP7_lesion_LsatKaiserSelbstschluss_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi         8986
## PRJNA804213_SsclP7_lesion_LsatKahu_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                        8986
## PRJNA804213_SsclP7_lesion_LsatCobhamGreen_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                 8986
## PRJNA804213_SsclP7_lesion_LsatBloodyWarrior_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi               8986
## PRJNA804213_SsclP7_lesion_LsatAmbassador_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                  8986
## PRJNA804213_SsclP7_lesion_LsatAdriatica2_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                  8986
## PRJNA804213_SsclP7_lesion_Lsat68_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                          8986
## PRJNA804213_SsclP7_lesion_LsatSimpson_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                     8986
## PRJNA804213_SsclP7_lesion_LsatSaladin_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi                     8986
## PRJNA804213_SsclP7_lesion_LsatRomainDeBenicardo_leaf_42hpi_vs_PRJNA804213_SsclP7_lesion_LsatAspen_leaf_42hpi           8986
bpr <- "PRJNA830457"
this_meta <- meta %>% filter(bioproject == bpr, host_accession != "resynthesized")
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

# I decided to exclude the resynthesized sample in case it isn't a good representative of Bnapus
# PRJNA830457_Sscl_periphery_BnapResynthesized_leaf_24hpi

contrasts <- matrix(c(
  'PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi', 'PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi', 'BrapvsBole',
  'PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi', 'PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi', 'BnapvsBole',
  'PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi', 'PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi', 'BrapvsBnap',
  'PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi', 'PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi', 'BolevsBnap',
  'PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi', 'PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi', 'BnapvsBrap',
  'PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi', 'PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi', 'BolevsBrap'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 78 rows containing non-finite values (`stat_bin()`).

##                                                                                                        up
## PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi 1322
## PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi  145
## PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi 1122
## PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi  235
## PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi  672
## PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi  663
##                                                                                                      down
## PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi  663
## PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi  235
## PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi  672
## PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi  145
## PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi 1122
## PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi 1322
##                                                                                                         n
## PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi 9037
## PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi 9037
## PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi 9037
## PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi 9037
## PRJNA830457_Sscl_periphery_BnapSentry_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi 9037
## PRJNA830457_Sscl_periphery_BoleTO1000_leaf_24hpi_vs_PRJNA830457_Sscl_periphery_BrapIMB218_leaf_24hpi 9037
bpr <- "PRJNA874732"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])

contrasts <- matrix(c(
  'PRJNA874732_Sscl1980dSsAOX_colony_IVMMGluSSE', 'PRJNA874732_Sscl1980_colony_IVMMGluSSE', 'none'
), ncol=3, byrow = TRUE)

contrasts <- process_contrast_mat(contrasts, this_meta)
pairwise_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ sample, kind = "pairwise")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                                                                                         up
## PRJNA874732_Sscl1980dSsAOX_colony_IVMMGluSSE_vs_PRJNA874732_Sscl1980_colony_IVMMGluSSE 830
##                                                                                        down
## PRJNA874732_Sscl1980dSsAOX_colony_IVMMGluSSE_vs_PRJNA874732_Sscl1980_colony_IVMMGluSSE 1055
##                                                                                           n
## PRJNA874732_Sscl1980dSsAOX_colony_IVMMGluSSE_vs_PRJNA874732_Sscl1980_colony_IVMMGluSSE 8596
pairwise_results_df <- do.call(rbind, pairwise_results)
rownames(pairwise_results_df) <- NULL

readr::write_tsv(pairwise_results_df, "output/dge_tests_pairwise.tsv", na = "-")
head(pairwise_results_df)
##   contrast_group  bioproject
## 1         IPvsIV PRJNA261444
## 2         IPvsIV PRJNA261444
## 3         IPvsIV PRJNA261444
## 4         IPvsIV PRJNA261444
## 5         IPvsIV PRJNA261444
## 6         IPvsIV PRJNA261444
##                                                                                                     contrast
## 1 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi
## 2 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi
## 3 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi
## 4 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi
## 5 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi
## 6 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi_vs_PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi
##                                                sample1
## 1 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi
## 2 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi
## 3 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi
## 4 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi
## 5 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi
## 6 PRJNA261444_SsclScl0205_lesion_PsatLifter_stem_12hpi
##                                              sample2 host1 host2
## 1 PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi  Psat    IV
## 2 PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi  Psat    IV
## 3 PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi  Psat    IV
## 4 PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi  Psat    IV
## 5 PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi  Psat    IV
## 6 PRJNA261444_SsclScl0205_periphery_IVPDA_stem_12hpi  Psat    IV
##   infection_stage1 infection_stage2              id  basemean        lfc
## 1                E             <NA> sscle_01g000010  81.68185 -0.1134843
## 2                E             <NA> sscle_01g000020 201.58016  0.9508778
## 3                E             <NA> sscle_01g000030  62.74210 -0.4577197
## 4                E             <NA> sscle_01g000040 122.67556 -0.9237598
## 5                E             <NA> sscle_01g000050 249.90577  2.5181344
## 6                E             <NA> sscle_01g000060 170.27916  0.6626822
##      lfc_se       stat       pvalue        padj
## 1 0.3340331 -0.3397397 0.7340525776 0.864516705
## 2 0.3490452  2.7242258 0.0064452425 0.046393391
## 3 0.4248877 -1.0772723 0.2813586444 0.522912787
## 4 0.4272295 -2.1622098 0.0306020090 0.138515974
## 5 0.6719367  3.7475767 0.0001785512 0.002506392
## 6 0.2943618  2.2512505 0.0243696779 0.119945132
tmp <- pairwise_results_df %>%
  filter(contrast_group == "IPvsIV", host1 == "Psat", padj < 0.01) %>%
  select(contrast, id) %>%
  split(., .[["contrast"]]) %>%
  lapply(FUN = function(df) {df[["id"]]})

upset(
  fromList(tmp),
  order.by = "freq",
  nsets = length(tmp),
  nintersects = 100
)

tmp <- pairwise_results_df %>%
  filter(contrast_group %in% c("MvsE", "LvsE", "LvsM", "MvsERes", "LvsERes", "LvsMres"), host1 == "Psat", padj < 0.01) %>%
  select(contrast, id) %>%
  split(., .[["contrast"]]) %>%
  lapply(FUN = function(df) {df[["id"]]})

upset(
  fromList(tmp),
  order.by = "freq",
  nsets = length(tmp),
  nintersects = 100
)

tmp <- pairwise_results_df %>%
  filter(contrast_group %in% c("MvsE", "LvsE", "LvsM", "MvsERes", "LvsERes", "LvsMres"), host1 == "Psat") %>%
  mutate(dge = as.integer(padj < 0.01)) %>%
  tidyr::pivot_wider(id_cols = "id", names_from = "contrast", values_from = "dge") %>%
  column_to_rownames("id")

tmp[is.na(tmp)] <- 0

heatmap(t(as.matrix(tmp)), labCol = FALSE, scale = "none", distfun = function(x) {dist(x, method = "binary")})

Processing marginal sets

For the meta analysis, we really only want one DGE test for each experiment and contrast type of interest. E.g. we would like to avoid having five ipvsiv contrasts, because the likely won’t be independent of each other. Here i’ll try to select the best sets that we can get.

host_results <- list()
ipvsiv_results <- list()
resistance_results <- list()
stage_results <- list()
virus_results <- list()

PRJNA261444

Generally i’ll test for susceptible vs resistance host differences. If the have significantly different responses, i’ll keep them separate.

bpr <- "PRJNA261444"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(resistance))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_resistance_contrast_mat(this_meta)

resistance_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ resistance + hpi, kind = "resistance")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                            up down    n
## PRJNA261444_Psat_SuscvsRes  2    2 8804

Because the resistant and susceptible cultivars are so similar, i won’t distinguish between them for the marginal analysis of IPvsIV and infection stage. In this case, because we have multiple time-points for the IV samples, i can do a two factor design.

bpr <- "PRJNA261444"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname + hpi, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 17 rows containing non-finite values (`stat_bin()`).

##                        up down    n
## PRJNA261444_PsatvsIV 2578 2865 8961
bpr <- "PRJNA261444"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(infection_stage)) %>% mutate(infection_stage = factor(gsub("Res$", "", infection_stage)))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_timepoint_contrast_mat(this_meta)

stage_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ infection_stage + resistance, kind = "infection_stage")
## converting counts to integer mode
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                         up down    n
## PRJNA261444_Psat_MvsE  872  604 8804
## PRJNA261444_Psat_LvsE 2064 1920 8804
## PRJNA261444_Psat_LvsM 1063  755 8804
bpr <- "PRJNA261444"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(ipvsivtp)) %>% mutate(ipvsivtp = factor(gsub("Res$", "", ipvsivtp)))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_ipvsivtp_contrast_mat(this_meta)

ipvsiv_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ ipvsivtp, kind = "ipvsivtp")
## converting counts to integer mode
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                          up down    n
## PRJNA261444_Psat_EvsIV 1116 1513 9212
## PRJNA261444_Psat_MvsIV 1939 2299 9212
## PRJNA261444_Psat_LvsIV 2467 2816 9212

PRJNA327437

bpr <- "PRJNA327437"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 21 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA327437 SRR3… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  2 PRJNA327437 SRR3… PRJNA… Bnap          1     E               <NA>       VF   
##  3 PRJNA327437 SRR3… PRJNA… Bnap          3     E               <NA>       VF   
##  4 PRJNA327437 SRR3… PRJNA… Bnap          6     E               <NA>       VF   
##  5 PRJNA327437 SRR3… PRJNA… Bnap          12    M               <NA>       VF   
##  6 PRJNA327437 SRR3… PRJNA… Bnap          24    M               <NA>       VF   
##  7 PRJNA327437 SRR3… PRJNA… Bnap          48    L               <NA>       VF   
##  8 PRJNA327437 SRR3… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  9 PRJNA327437 SRR3… PRJNA… Bnap          1     E               <NA>       VF   
## 10 PRJNA327437 SRR3… PRJNA… Bnap          3     E               <NA>       VF   
## # ℹ 11 more rows
## # ℹ 1 more variable: ipvsivtp <fct>

Here the factors of interest are IP vs IV, and 6 time points.

Because we don’t have multiple timepoints for the invitro samples, we can’t actually do a full marginal estimate. The problem is that if we ignore the hpi, the variance will look very high and we’ll only pick up things that are DE in all samples. I think the best option will probably be to pick a “representative” time-point that’s comparable across experiments?

tmp <- lcounts %>% filter(host_tidyname == "Bnap") %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = cpm) %>%
  column_to_rownames("id") %>%
  as.matrix()

pca_raw <- princomp(tmp, fix_sign = TRUE)

prop_var <- ((pca_raw$sdev[1:10] / sum(pca_raw$sdev[1:10])) * 100) %>%
  data.frame(variance_explained = .) %>%
  rownames_to_column("PC") %>%
  mutate(PC = paste0("PC", sprintf("%02d", 1:n())))

print(ggplot(prop_var, aes(x=PC, y=variance_explained)) + geom_bar(stat = "identity"))

pca <- as.data.frame(pca_raw$loadings[, 1:3])
colnames(pca) <- paste0("PC", sprintf("%02d", seq_len(ncol(pca))))
pca <- pca %>% rownames_to_column("sra")
pca <- right_join(meta %>% select(bioproject, sra, hpi), pca, by = "sra") %>%
  tidyr::pivot_longer(-c(bioproject, sra, hpi), names_to = "PC")

gg <- ggplot(pca, aes(x=hpi, y=value, color=bioproject)) +
  geom_point(alpha = 0.7, size = 3) +
  facet_grid(cols = vars(PC))

print(gg)

Actually, it’s pretty unclear what’s “representative”. I think i’ll just need to stick with processing inplanta vs invitro at each of our defined stages. I think it’s reasonable to pool some close time-points, and then at the end we can decide which of the three infection stages is most useful (probably mid or late though).

bpr <- "PRJNA327437"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 96 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                       up down    n
## PRJNA327437_BnapvsIV 502  271 9612
bpr <- "PRJNA327437"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(ipvsivtp))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_ipvsivtp_contrast_mat(this_meta)

ipvsiv_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ ipvsivtp, kind = "ipvsivtp")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                          up down    n
## PRJNA327437_Bnap_EvsIV 1247  811 9509
## PRJNA327437_Bnap_MvsIV 1110  669 9509
## PRJNA327437_Bnap_LvsIV 1711 1133 9509
bpr <- "PRJNA327437"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(infection_stage)) %>% mutate(infection_stage = factor(gsub("Res$", "", infection_stage)))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_timepoint_contrast_mat(this_meta)

stage_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ infection_stage, kind = "infection_stage")
## converting counts to integer mode
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                         up down    n
## PRJNA327437_Bnap_MvsE 1750 1698 9439
## PRJNA327437_Bnap_LvsE 2216 1964 9439
## PRJNA327437_Bnap_LvsM 1373 1206 9439

PRJNA341340

bpr <- "PRJNA341340"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 15 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA341340 SRR4… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  2 PRJNA341340 SRR4… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  3 PRJNA341340 SRR4… PRJNA… Slys          <NA>  <NA>            <NA>       VF   
##  4 PRJNA341340 SRR4… PRJNA… Slys          <NA>  <NA>            <NA>       VF   
##  5 PRJNA341340 SRR4… PRJNA… Hann          <NA>  <NA>            <NA>       VF   
##  6 PRJNA341340 SRR4… PRJNA… Hann          <NA>  <NA>            <NA>       VF   
##  7 PRJNA341340 SRR4… PRJNA… Hann          <NA>  <NA>            <NA>       VF   
##  8 PRJNA341340 SRR4… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  9 PRJNA341340 SRR4… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 10 PRJNA341340 SRR4… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 11 PRJNA341340 SRR4… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 12 PRJNA341340 SRR4… PRJNA… Atha          <NA>  <NA>            <NA>       VF   
## 13 PRJNA341340 SRR4… PRJNA… Atha          <NA>  <NA>            <NA>       VF   
## 14 PRJNA341340 SRR4… PRJNA… Atha          <NA>  <NA>            <NA>       VF   
## 15 PRJNA341340 SRR4… PRJNA… Slys          <NA>  <NA>            <NA>       VF   
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA341340"
this_meta <- meta %>% filter(bioproject == bpr, tissue != "sclerotia")
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 765 rows containing non-finite values (`stat_bin()`).

##                          up down    n
## PRJNA341340_SlysvsIV   2049 2503 9194
## PRJNA341340_HannvsIV   2365 3032 9194
## PRJNA341340_AthavsIV   1854 2396 9194
## PRJNA341340_HannvsSlys  550  833 9194
## PRJNA341340_AthavsSlys  362  210 9194
## PRJNA341340_SlysvsHann  833  550 9194
## PRJNA341340_AthavsHann 1055  852 9194
## PRJNA341340_SlysvsAtha  210  362 9194
## PRJNA341340_HannvsAtha  852 1055 9194

PRJNA418121

bpr <- "PRJNA418121"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 6 × 9
##   bioproject  sra    sample host_tidyname hpi   infection_stage resistance virus
##   <chr>       <chr>  <fct>  <fct>         <fct> <fct>           <fct>      <fct>
## 1 PRJNA418121 SRR62… PRJNA… Atha          50    <NA>            <NA>       VF   
## 2 PRJNA418121 SRR62… PRJNA… Atha          50    <NA>            <NA>       VF   
## 3 PRJNA418121 SRR62… PRJNA… Atha          50    <NA>            <NA>       VF   
## 4 PRJNA418121 SRR62… PRJNA… Slys          50    <NA>            <NA>       VF   
## 5 PRJNA418121 SRR62… PRJNA… Slys          50    <NA>            <NA>       VF   
## 6 PRJNA418121 SRR62… PRJNA… Slys          50    <NA>            <NA>       VF   
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA418121"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 4 rows containing non-finite values (`stat_bin()`).

##                         up down    n
## PRJNA418121_SlysvsAtha 690  755 8023
## PRJNA418121_AthavsSlys 755  690 8023

PRJNA471709

bpr <- "PRJNA471709"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 18 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA471709 SRR7… PRJNA… Gmax          24    ERes            Res        VF   
##  2 PRJNA471709 SRR7… PRJNA… Gmax          24    ERes            Res        VF   
##  3 PRJNA471709 SRR7… PRJNA… Gmax          24    ERes            Res        VF   
##  4 PRJNA471709 SRR7… PRJNA… Gmax          48    MRes            Res        VF   
##  5 PRJNA471709 SRR7… PRJNA… Gmax          48    MRes            Res        VF   
##  6 PRJNA471709 SRR7… PRJNA… Gmax          48    MRes            Res        VF   
##  7 PRJNA471709 SRR7… PRJNA… Gmax          96    LRes            Res        VF   
##  8 PRJNA471709 SRR7… PRJNA… Gmax          96    LRes            Res        VF   
##  9 PRJNA471709 SRR7… PRJNA… Gmax          96    LRes            Res        VF   
## 10 PRJNA471709 SRR7… PRJNA… Gmax          24    E               Susc       VF   
## 11 PRJNA471709 SRR7… PRJNA… Gmax          24    E               Susc       VF   
## 12 PRJNA471709 SRR7… PRJNA… Gmax          24    E               Susc       VF   
## 13 PRJNA471709 SRR7… PRJNA… Gmax          48    M               Susc       VF   
## 14 PRJNA471709 SRR7… PRJNA… Gmax          48    M               Susc       VF   
## 15 PRJNA471709 SRR7… PRJNA… Gmax          48    M               Susc       VF   
## 16 PRJNA471709 SRR7… PRJNA… Gmax          96    L               Susc       VF   
## 17 PRJNA471709 SRR7… PRJNA… Gmax          96    L               Susc       VF   
## 18 PRJNA471709 SRR7… PRJNA… Gmax          96    L               Susc       VF   
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA471709"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(resistance))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_resistance_contrast_mat(this_meta)

resistance_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ resistance + hpi, kind = "resistance")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 94 rows containing non-finite values (`stat_bin()`).

##                             up down    n
## PRJNA471709_Gmax_SuscvsRes 175  138 9248

There are enough differences in here between resistant and susceptible that I want to keep them separate.

bpr <- "PRJNA471709"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(infection_stage))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_timepoint_contrast_mat(this_meta)

stage_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ infection_stage, kind = "infection_stage")
## converting counts to integer mode
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 252 rows containing non-finite values (`stat_bin()`).

##                              up down    n
## PRJNA471709_Gmax_MResvsERes 454  323 9248
## PRJNA471709_Gmax_LResvsERes 943  721 9248
## PRJNA471709_Gmax_LResvsMRes 265  174 9248
## PRJNA471709_Gmax_MvsE       376  172 9248
## PRJNA471709_Gmax_LvsE       714  569 9248
## PRJNA471709_Gmax_LvsM       139  160 9248

PRJNA477716

bpr <- "PRJNA477716"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, host_accession_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 15 × 10
##    bioproject  sra        sample      host_tidyname host_accession_tidyn…¹ hpi  
##    <chr>       <chr>      <fct>       <fct>         <chr>                  <fct>
##  1 PRJNA477716 SRR7418154 PRJNA47771… IV            PDB                    96   
##  2 PRJNA477716 SRR7418155 PRJNA47771… IV            PDB                    96   
##  3 PRJNA477716 SRR7418156 PRJNA47771… IV            PDB                    96   
##  4 PRJNA477716 SRR7418157 PRJNA47771… IV            MM                     96   
##  5 PRJNA477716 SRR7418158 PRJNA47771… IV            MM                     96   
##  6 PRJNA477716 SRR7418159 PRJNA47771… IV            MM                     96   
##  7 PRJNA477716 SRR7418160 PRJNA47771… IV            PDA                    48   
##  8 PRJNA477716 SRR7418161 PRJNA47771… IV            PDA                    48   
##  9 PRJNA477716 SRR7418162 PRJNA47771… IV            PDA                    48   
## 10 PRJNA477716 SRR7418163 PRJNA47771… IV            PDA                    48   
## 11 PRJNA477716 SRR7418164 PRJNA47771… IV            PDA                    48   
## 12 PRJNA477716 SRR7418165 PRJNA47771… IV            PDA                    48   
## 13 PRJNA477716 SRR7418166 PRJNA47771… Atha          Col0                   48   
## 14 PRJNA477716 SRR7418167 PRJNA47771… Atha          Col0                   48   
## 15 PRJNA477716 SRR7418168 PRJNA47771… Atha          Col0                   48   
## # ℹ abbreviated name: ¹​host_accession_tidyname
## # ℹ 4 more variables: infection_stage <fct>, resistance <fct>, virus <fct>,
## #   ipvsivtp <fct>
bpr <- "PRJNA477716"
this_meta <- meta %>% filter(bioproject == bpr, host_accession_tidyname != "PDB", host_accession_tidyname != "MM")
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 18 rows containing non-finite values (`stat_bin()`).

##                        up down    n
## PRJNA477716_AthavsIV 2478 2547 8336

PRJNA501892

bpr <- "PRJNA501892"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 20 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA501892 SRR8… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  2 PRJNA501892 SRR8… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  3 PRJNA501892 SRR8… PRJNA… Gmax          24    ERes            Res        VF   
##  4 PRJNA501892 SRR8… PRJNA… Gmax          24    ERes            Res        VF   
##  5 PRJNA501892 SRR8… PRJNA… Gmax          24    ERes            Res        VF   
##  6 PRJNA501892 SRR8… PRJNA… Gmax          48    MRes            Res        VF   
##  7 PRJNA501892 SRR8… PRJNA… Gmax          48    MRes            Res        VF   
##  8 PRJNA501892 SRR8… PRJNA… Gmax          48    MRes            Res        VF   
##  9 PRJNA501892 SRR8… PRJNA… Gmax          96    LRes            Res        VF   
## 10 PRJNA501892 SRR8… PRJNA… Gmax          96    LRes            Res        VF   
## 11 PRJNA501892 SRR8… PRJNA… Gmax          96    LRes            Res        VF   
## 12 PRJNA501892 SRR8… PRJNA… Gmax          24    E               Susc       VF   
## 13 PRJNA501892 SRR8… PRJNA… Gmax          24    E               Susc       VF   
## 14 PRJNA501892 SRR8… PRJNA… Gmax          24    E               Susc       VF   
## 15 PRJNA501892 SRR8… PRJNA… Gmax          48    M               Susc       VF   
## 16 PRJNA501892 SRR8… PRJNA… Gmax          48    M               Susc       VF   
## 17 PRJNA501892 SRR8… PRJNA… Gmax          48    M               Susc       VF   
## 18 PRJNA501892 SRR8… PRJNA… Gmax          96    L               Susc       VF   
## 19 PRJNA501892 SRR8… PRJNA… Gmax          96    L               Susc       VF   
## 20 PRJNA501892 SRR8… PRJNA… Gmax          96    L               Susc       VF   
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA501892"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(resistance))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_resistance_contrast_mat(this_meta)

resistance_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ resistance + hpi, kind = "resistance")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 94 rows containing non-finite values (`stat_bin()`).

##                             up down    n
## PRJNA501892_Gmax_SuscvsRes 175  138 9248

I think probably I should keep them separate.

bpr <- "PRJNA501892"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(ipvsivtp))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_ipvsivtp_contrast_mat(this_meta)

ipvsiv_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ ipvsivtp, kind = "ipvsivtp")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 198 rows containing non-finite values (`stat_bin()`).

##                             up down    n
## PRJNA501892_Gmax_EResvsIV 1875 1589 9294
## PRJNA501892_Gmax_MResvsIV 1849 1385 9294
## PRJNA501892_Gmax_LResvsIV 2234 1794 9294
## PRJNA501892_Gmax_EvsIV    1897 1640 9294
## PRJNA501892_Gmax_MvsIV    1803 1290 9294
## PRJNA501892_Gmax_LvsIV    2071 1773 9294
bpr <- "PRJNA501892"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 252 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                        up down    n
## PRJNA501892_GmaxvsIV 2072 1786 9499
bpr <- "PRJNA501892"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(infection_stage))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_timepoint_contrast_mat(this_meta)

stage_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ infection_stage, kind = "infection_stage")
## converting counts to integer mode
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 252 rows containing non-finite values (`stat_bin()`).

##                              up down    n
## PRJNA501892_Gmax_MResvsERes 454  323 9248
## PRJNA501892_Gmax_LResvsERes 944  721 9248
## PRJNA501892_Gmax_LResvsMRes 265  174 9248
## PRJNA501892_Gmax_MvsE       376  172 9248
## PRJNA501892_Gmax_LvsE       714  569 9248
## PRJNA501892_Gmax_LvsM       139  160 9248

PRJNA574280

bpr <- "PRJNA574280"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 12 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA574280 SRR1… PRJNA… Pvul          50    <NA>            <NA>       VF   
##  2 PRJNA574280 SRR1… PRJNA… Hann          24    <NA>            <NA>       VF   
##  3 PRJNA574280 SRR1… PRJNA… Hann          24    <NA>            <NA>       VF   
##  4 PRJNA574280 SRR1… PRJNA… Hann          24    <NA>            <NA>       VF   
##  5 PRJNA574280 SRR1… PRJNA… Bvulvul       72    <NA>            <NA>       VF   
##  6 PRJNA574280 SRR1… PRJNA… Bvulvul       72    <NA>            <NA>       VF   
##  7 PRJNA574280 SRR1… PRJNA… Bvulvul       72    <NA>            <NA>       VF   
##  8 PRJNA574280 SRR1… PRJNA… Rcom          50    <NA>            <NA>       VF   
##  9 PRJNA574280 SRR1… PRJNA… Rcom          50    <NA>            <NA>       VF   
## 10 PRJNA574280 SRR1… PRJNA… Rcom          50    <NA>            <NA>       VF   
## 11 PRJNA574280 SRR1… PRJNA… Pvul          50    <NA>            <NA>       VF   
## 12 PRJNA574280 SRR1… PRJNA… Pvul          50    <NA>            <NA>       VF   
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA574280"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 576 rows containing non-finite values (`stat_bin()`).

##                             up down    n
## PRJNA574280_HannvsPvul     841 1181 9086
## PRJNA574280_BvulvulvsPvul  921  618 9086
## PRJNA574280_RcomvsPvul    1587 1643 9086
## PRJNA574280_PvulvsHann    1181  841 9086
## PRJNA574280_BvulvulvsHann 2523 1960 9086
## PRJNA574280_RcomvsHann    2520 2085 9086
## PRJNA574280_PvulvsBvulvul  618  921 9086
## PRJNA574280_HannvsBvulvul 1960 2523 9086
## PRJNA574280_RcomvsBvulvul 2060 2343 9086
## PRJNA574280_PvulvsRcom    1643 1587 9086
## PRJNA574280_HannvsRcom    2085 2520 9086
## PRJNA574280_BvulvulvsRcom 2343 2060 9086

PRJNA577619

bpr <- "PRJNA577619"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 18 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA577619 SRR1… PRJNA… Bnap          12    M               <NA>       SsHA…
##  2 PRJNA577619 SRR1… PRJNA… Bnap          12    M               <NA>       SsHA…
##  3 PRJNA577619 SRR1… PRJNA… Bnap          12    M               <NA>       VF   
##  4 PRJNA577619 SRR1… PRJNA… Bnap          12    M               <NA>       VF   
##  5 PRJNA577619 SRR1… PRJNA… Bnap          12    M               <NA>       SsHA…
##  6 PRJNA577619 SRR1… PRJNA… Bnap          24    M               <NA>       VF   
##  7 PRJNA577619 SRR1… PRJNA… Bnap          24    M               <NA>       VF   
##  8 PRJNA577619 SRR1… PRJNA… Bnap          24    M               <NA>       VF   
##  9 PRJNA577619 SRR1… PRJNA… Bnap          18    M               <NA>       VF   
## 10 PRJNA577619 SRR1… PRJNA… Bnap          18    M               <NA>       VF   
## 11 PRJNA577619 SRR1… PRJNA… Bnap          18    M               <NA>       VF   
## 12 PRJNA577619 SRR1… PRJNA… Bnap          12    M               <NA>       VF   
## 13 PRJNA577619 SRR1… PRJNA… Bnap          24    M               <NA>       SsHA…
## 14 PRJNA577619 SRR1… PRJNA… Bnap          24    M               <NA>       SsHA…
## 15 PRJNA577619 SRR1… PRJNA… Bnap          24    M               <NA>       SsHA…
## 16 PRJNA577619 SRR1… PRJNA… Bnap          18    M               <NA>       SsHA…
## 17 PRJNA577619 SRR1… PRJNA… Bnap          18    M               <NA>       SsHA…
## 18 PRJNA577619 SRR1… PRJNA… Bnap          18    M               <NA>       SsHA…
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA577619"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(virus))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_virus_contrast_mat(this_meta)

virus_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ virus + hpi, kind = "virus")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 5 rows containing non-finite values (`stat_bin()`).

##                               up down    n
## PRJNA577619_Bnap_SsHADVvsVF 3089 3360 8696

PRJNA593737

bpr <- "PRJNA593737"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 12 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
##  2 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
##  3 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
##  4 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
##  5 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
##  6 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
##  7 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
##  8 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  9 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
## 10 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsNS…
## 11 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 12 PRJNA593737 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA593737"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(virus), !sample %in% c("PRJNA593737_SsclZ11OXSsNSRV1_colony_IVPDA", "PRJNA593737_SsclZ113OXSsNSRV1_colony_IVPDA"))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_virus_contrast_mat(this_meta)

virus_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ virus, kind = "virus")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 10 rows containing non-finite values (`stat_bin()`).

##                              up down    n
## PRJNA593737_IV_SsNSRV1vsVF 2473 2658 8374

PRJNA641217

bpr <- "PRJNA641217"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 11 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA641217 SRR1… PRJNA… Bnap          <NA>  <NA>            <NA>       VF   
##  2 PRJNA641217 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  3 PRJNA641217 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  4 PRJNA641217 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  5 PRJNA641217 SRR1… PRJNA… Bnap          <NA>  <NA>            <NA>       SsHA…
##  6 PRJNA641217 SRR1… PRJNA… Bnap          <NA>  <NA>            <NA>       SsHA…
##  7 PRJNA641217 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsHA…
##  8 PRJNA641217 SRR1… PRJNA… Bnap          <NA>  <NA>            <NA>       VF   
##  9 PRJNA641217 SRR1… PRJNA… Bnap          <NA>  <NA>            <NA>       VF   
## 10 PRJNA641217 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsHA…
## 11 PRJNA641217 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       SsHA…
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA641217"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(virus))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_virus_contrast_mat(this_meta)

virus_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ virus + host_tidyname, kind = "virus")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 42 rows containing non-finite values (`stat_bin()`).

##                               up down    n
## PRJNA641217_Bnap_SsHADVvsVF 3108 2992 8906
## PRJNA641217_IV_SsHADVvsVF   3108 2992 8906

PRJNA641462

bpr <- "PRJNA641462"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 5 × 9
##   bioproject  sra    sample host_tidyname hpi   infection_stage resistance virus
##   <chr>       <chr>  <fct>  <fct>         <fct> <fct>           <fct>      <fct>
## 1 PRJNA641462 SRR12… PRJNA… Bnap          <NA>  <NA>            <NA>       VF   
## 2 PRJNA641462 SRR12… PRJNA… Bnap          <NA>  <NA>            <NA>       VF   
## 3 PRJNA641462 SRR12… PRJNA… Bnap          <NA>  <NA>            <NA>       VF   
## 4 PRJNA641462 SRR12… PRJNA… Bnap          <NA>  <NA>            <NA>       SsHA…
## 5 PRJNA641462 SRR12… PRJNA… Bnap          <NA>  <NA>            <NA>       SsHA…
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA641462"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(virus))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_virus_contrast_mat(this_meta)

virus_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ virus, kind = "virus")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                               up down    n
## PRJNA641462_Bnap_SsHADVvsVF 2192 2003 8513

PRJNA643804

bpr <- "PRJNA643804"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 6 × 9
##   bioproject  sra    sample host_tidyname hpi   infection_stage resistance virus
##   <chr>       <chr>  <fct>  <fct>         <fct> <fct>           <fct>      <fct>
## 1 PRJNA643804 SRR12… PRJNA… IV            <NA>  <NA>            <NA>       SlaG…
## 2 PRJNA643804 SRR12… PRJNA… IV            <NA>  <NA>            <NA>       SlaG…
## 3 PRJNA643804 SRR12… PRJNA… IV            <NA>  <NA>            <NA>       SlaG…
## 4 PRJNA643804 SRR12… PRJNA… IV            <NA>  <NA>            <NA>       SlaG…
## 5 PRJNA643804 SRR12… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 6 PRJNA643804 SRR12… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA643804"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(virus))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_virus_contrast_mat(this_meta)

virus_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ virus, kind = "virus")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 15 rows containing non-finite values (`stat_bin()`).

##                               up down    n
## PRJNA643804_IV_SlaGemV1vsVF 1902 1854 9718

PRJNA670487

bpr <- "PRJNA670487"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 48 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  2 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  3 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  4 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  5 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  6 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  7 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  8 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  9 PRJNA670487 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 10 PRJNA670487 SRR1… PRJNA… Atha          50    <NA>            <NA>       VF   
## # ℹ 38 more rows
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA670487"
this_meta <- meta %>% filter(bioproject == bpr, sample != "PRJNA670487_Sscl1980_ball_IVPDB")
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 2 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 72 rows containing non-finite values (`stat_bin()`).

##                             up down    n
## PRJNA670487_AthavsIV      1709 1912 9739
## PRJNA670487_SlysvsIV      1625 1678 9739
## PRJNA670487_HannvsIV      2133 2146 9739
## PRJNA670487_BvulvulvsIV   3343 2899 9739
## PRJNA670487_RcomvsIV      3204 3204 9739
## PRJNA670487_PvulvsIV      2433 2317 9739
## PRJNA670487_SlysvsAtha     279  326 9739
## PRJNA670487_HannvsAtha    1820 1800 9739
## PRJNA670487_BvulvulvsAtha 2433 1747 9739
## PRJNA670487_RcomvsAtha    2650 2480 9739
## PRJNA670487_PvulvsAtha     987  479 9739
## PRJNA670487_AthavsSlys     326  279 9739
## PRJNA670487_HannvsSlys    1651 1507 9739
## PRJNA670487_BvulvulvsSlys 2274 1571 9739
## PRJNA670487_RcomvsSlys    2476 2295 9739
## PRJNA670487_PvulvsSlys     828  387 9739
## PRJNA670487_AthavsHann    1800 1820 9739
## PRJNA670487_SlysvsHann    1507 1651 9739
## PRJNA670487_BvulvulvsHann 3372 2486 9739
## PRJNA670487_RcomvsHann    2308 2186 9739
## PRJNA670487_PvulvsHann    2091 1778 9739
## PRJNA670487_AthavsBvulvul 1747 2433 9739
## PRJNA670487_SlysvsBvulvul 1571 2274 9739
## PRJNA670487_HannvsBvulvul 2486 3372 9739
## PRJNA670487_RcomvsBvulvul 2386 2811 9739
## PRJNA670487_PvulvsBvulvul 1015 1197 9739
## PRJNA670487_AthavsRcom    2480 2650 9739
## PRJNA670487_SlysvsRcom    2295 2476 9739
## PRJNA670487_HannvsRcom    2186 2308 9739
## PRJNA670487_BvulvulvsRcom 2811 2386 9739
## PRJNA670487_PvulvsRcom    2269 1993 9739
## PRJNA670487_AthavsPvul     479  987 9739
## PRJNA670487_SlysvsPvul     387  828 9739
## PRJNA670487_HannvsPvul    1778 2091 9739
## PRJNA670487_BvulvulvsPvul 1197 1015 9739
## PRJNA670487_RcomvsPvul    1993 2269 9739

PRJNA687280

bpr <- "PRJNA687280"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 33 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA687280 SRR1… PRJNA… Cari          12    ERes            Res        <NA> 
##  2 PRJNA687280 SRR1… PRJNA… Cari          12    ERes            Res        <NA> 
##  3 PRJNA687280 SRR1… PRJNA… Cari          12    ERes            Res        <NA> 
##  4 PRJNA687280 SRR1… PRJNA… Cari          6     ERes            Res        <NA> 
##  5 PRJNA687280 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       <NA> 
##  6 PRJNA687280 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       <NA> 
##  7 PRJNA687280 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       <NA> 
##  8 PRJNA687280 SRR1… PRJNA… Cari          72    L               Susc       <NA> 
##  9 PRJNA687280 SRR1… PRJNA… Cari          72    L               Susc       <NA> 
## 10 PRJNA687280 SRR1… PRJNA… Cari          72    L               Susc       <NA> 
## # ℹ 23 more rows
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA687280"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(resistance))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_resistance_contrast_mat(this_meta)

resistance_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ resistance + hpi, kind = "resistance")
## converting counts to integer mode
## factor levels were dropped which had no samples
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 13 rows containing non-finite values (`stat_bin()`).

##                             up down    n
## PRJNA687280_Cari_SuscvsRes 286  314 9068

The PCA plot shows that the time-points have a much larger impact than the resistance or susceptibily. But there are a few hundred DGEs, so i’ll keep them separate.

bpr <- "PRJNA687280"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 35 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                        up down    n
## PRJNA687280_CarivsIV 3178 3845 9927
bpr <- "PRJNA687280"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(infection_stage))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_timepoint_contrast_mat(this_meta)

stage_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ infection_stage, kind = "infection_stage")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 74 rows containing non-finite values (`stat_bin()`).

##                               up down    n
## PRJNA687280_Cari_LResvsERes 1597 1508 9405
## PRJNA687280_Cari_LvsE       1771 1241 9405
bpr <- "PRJNA687280"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(ipvsivtp))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_ipvsivtp_contrast_mat(this_meta)

ipvsiv_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ ipvsivtp, kind = "ipvsivtp")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 120 rows containing non-finite values (`stat_bin()`).

##                             up down    n
## PRJNA687280_Cari_EResvsIV 2986 4024 9694
## PRJNA687280_Cari_LvsIV    3158 3712 9694
## PRJNA687280_Cari_EvsIV    2941 3978 9694
## PRJNA687280_Cari_LResvsIV 2962 3811 9694

PRJNA695466

bpr <- "PRJNA695466"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 6 × 9
##   bioproject  sra    sample host_tidyname hpi   infection_stage resistance virus
##   <chr>       <chr>  <fct>  <fct>         <fct> <fct>           <fct>      <fct>
## 1 PRJNA695466 SRR13… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 2 PRJNA695466 SRR13… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 3 PRJNA695466 SRR13… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 4 PRJNA695466 SRR13… PRJNA… IV            <NA>  <NA>            <NA>       SsHA…
## 5 PRJNA695466 SRR13… PRJNA… IV            <NA>  <NA>            <NA>       SsHA…
## 6 PRJNA695466 SRR13… PRJNA… IV            <NA>  <NA>            <NA>       SsHA…
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA695466"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(virus))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_virus_contrast_mat(this_meta)

virus_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ virus, kind = "virus")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 3 rows containing non-finite values (`stat_bin()`).

##                             up down    n
## PRJNA695466_IV_SsHADVvsVF 3154 3205 8855

PRJNA706136

bpr <- "PRJNA706136"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 6 × 9
##   bioproject  sra    sample host_tidyname hpi   infection_stage resistance virus
##   <chr>       <chr>  <fct>  <fct>         <fct> <fct>           <fct>      <fct>
## 1 PRJNA706136 SRR13… PRJNA… Bole          8     <NA>            <NA>       <NA> 
## 2 PRJNA706136 SRR13… PRJNA… Bvil          8     <NA>            <NA>       <NA> 
## 3 PRJNA706136 SRR13… PRJNA… Bvil          8     <NA>            <NA>       <NA> 
## 4 PRJNA706136 SRR13… PRJNA… Bvil          8     <NA>            <NA>       <NA> 
## 5 PRJNA706136 SRR13… PRJNA… Bole          8     <NA>            <NA>       <NA> 
## 6 PRJNA706136 SRR13… PRJNA… Bole          8     <NA>            <NA>       <NA> 
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA706136"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                         up down    n
## PRJNA706136_BvilvsBole 283   85 7197
## PRJNA706136_BolevsBvil  85  283 7197

PRJNA735329

bpr <- "PRJNA735329"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 9 × 9
##   bioproject  sra    sample host_tidyname hpi   infection_stage resistance virus
##   <chr>       <chr>  <fct>  <fct>         <fct> <fct>           <fct>      <fct>
## 1 PRJNA735329 SRR14… PRJNA… Bnap          48    LRes            Res        VF   
## 2 PRJNA735329 SRR14… PRJNA… Bnap          48    LRes            Res        VF   
## 3 PRJNA735329 SRR14… PRJNA… Bnap          48    LRes            Res        VF   
## 4 PRJNA735329 SRR14… PRJNA… Bnap          24    MRes            Res        VF   
## 5 PRJNA735329 SRR14… PRJNA… Bnap          24    MRes            Res        VF   
## 6 PRJNA735329 SRR14… PRJNA… Bnap          24    MRes            Res        VF   
## 7 PRJNA735329 SRR14… PRJNA… Bnap          6     ERes            Res        VF   
## 8 PRJNA735329 SRR14… PRJNA… Bnap          6     ERes            Res        VF   
## 9 PRJNA735329 SRR14… PRJNA… Bnap          6     ERes            Res        VF   
## # ℹ 1 more variable: ipvsivtp <fct>
# CHECK

bpr <- "PRJNA735329"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(infection_stage))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_timepoint_contrast_mat(this_meta)

stage_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ infection_stage, kind = "infection_stage")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (`stat_bin()`).

##                               up down    n
## PRJNA735329_Bnap_LResvsMRes 1088  811 8993
## PRJNA735329_Bnap_LResvsERes 1695 1283 8993
## PRJNA735329_Bnap_MResvsERes 1168  921 8993

PRJNA766564

bpr <- "PRJNA766564"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 9 × 9
##   bioproject  sra    sample host_tidyname hpi   infection_stage resistance virus
##   <chr>       <chr>  <fct>  <fct>         <fct> <fct>           <fct>      <fct>
## 1 PRJNA766564 SRR16… PRJNA… Bnap          24    MRes            Res        <NA> 
## 2 PRJNA766564 SRR16… PRJNA… Bnap          168   LRes            Res        <NA> 
## 3 PRJNA766564 SRR16… PRJNA… Bnap          168   LRes            Res        <NA> 
## 4 PRJNA766564 SRR16… PRJNA… Bnap          24    M               <NA>       <NA> 
## 5 PRJNA766564 SRR16… PRJNA… Bnap          24    M               <NA>       <NA> 
## 6 PRJNA766564 SRR16… PRJNA… Bnap          24    M               <NA>       <NA> 
## 7 PRJNA766564 SRR16… PRJNA… Bnap          168   L               <NA>       <NA> 
## 8 PRJNA766564 SRR16… PRJNA… Bnap          168   L               <NA>       <NA> 
## 9 PRJNA766564 SRR16… PRJNA… Bnap          168   L               <NA>       <NA> 
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA766564"
this_meta <- meta %>% filter(bioproject == bpr, sample != "PRJNA766564_Sscl_lesion_Bnap1703_stem_24hpi") %>% mutate(resistance = ifelse(is.na(resistance), "Susc", "Res"))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_resistance_contrast_mat(this_meta)

resistance_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ resistance + hpi, kind = "resistance")
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                            up down    n
## PRJNA766564_Bnap_SuscvsRes  6    1 8776

There’s so little difference between resistance and susceptible that we won’t worry about it.

bpr <- "PRJNA766564"
this_meta <- meta %>%
  filter(bioproject == bpr, !is.na(infection_stage), sample != "PRJNA766564_Sscl_lesion_Bnap1703_stem_24hpi") %>%
  mutate(infection_stage = factor(gsub("Res$", "", infection_stage))) %>%
  mutate(resistance = ifelse(is.na(resistance), "Susc", "Res"))

this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_timepoint_contrast_mat(this_meta)

stage_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ infection_stage + resistance, kind = "infection_stage")
## converting counts to integer mode
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                         up down    n
## PRJNA766564_Bnap_LvsM 1352  914 8776

PRJNA777355

bpr <- "PRJNA777355"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 18 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA777355 SRR1… PRJNA… Bnap          12    M               <NA>       VF   
##  2 PRJNA777355 SRR1… PRJNA… Bnap          6     E               <NA>       VF   
##  3 PRJNA777355 SRR1… PRJNA… Bnap          6     E               <NA>       VF   
##  4 PRJNA777355 SRR1… PRJNA… Bnap          6     E               <NA>       VF   
##  5 PRJNA777355 SRR1… PRJNA… Bnap          2     E               <NA>       VF   
##  6 PRJNA777355 SRR1… PRJNA… Bnap          2     E               <NA>       VF   
##  7 PRJNA777355 SRR1… PRJNA… Bnap          2     E               <NA>       VF   
##  8 PRJNA777355 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
##  9 PRJNA777355 SRR1… PRJNA… Bnap          36    M               <NA>       VF   
## 10 PRJNA777355 SRR1… PRJNA… Bnap          36    M               <NA>       VF   
## 11 PRJNA777355 SRR1… PRJNA… Bnap          36    M               <NA>       VF   
## 12 PRJNA777355 SRR1… PRJNA… Bnap          24    M               <NA>       VF   
## 13 PRJNA777355 SRR1… PRJNA… Bnap          24    M               <NA>       VF   
## 14 PRJNA777355 SRR1… PRJNA… Bnap          24    M               <NA>       VF   
## 15 PRJNA777355 SRR1… PRJNA… Bnap          12    M               <NA>       VF   
## 16 PRJNA777355 SRR1… PRJNA… Bnap          12    M               <NA>       VF   
## 17 PRJNA777355 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## 18 PRJNA777355 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       VF   
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA777355"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 143 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                        up down    n
## PRJNA777355_BnapvsIV 1864  735 9505
bpr <- "PRJNA777355"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(infection_stage))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_timepoint_contrast_mat(this_meta)

stage_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ infection_stage, kind = "infection_stage")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 6 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 1 rows containing non-finite values (`stat_bin()`).

##                         up down     n
## PRJNA777355_Bnap_MvsE 1568 1886 10393
bpr <- "PRJNA777355"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(ipvsivtp))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_ipvsivtp_contrast_mat(this_meta)

ipvsiv_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ ipvsivtp, kind = "ipvsivtp")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 2 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                          up down    n
## PRJNA777355_Bnap_MvsIV 1739  911 9954
## PRJNA777355_Bnap_EvsIV 2599 1526 9954

PRJNA789389

bpr <- "PRJNA789389"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 12 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA789389 SRR1… PRJNA… Gmax          8     E               Susc       <NA> 
##  2 PRJNA789389 SRR1… PRJNA… Gmax          8     E               Susc       <NA> 
##  3 PRJNA789389 SRR1… PRJNA… Gmax          8     E               Susc       <NA> 
##  4 PRJNA789389 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       <NA> 
##  5 PRJNA789389 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       <NA> 
##  6 PRJNA789389 SRR1… PRJNA… IV            <NA>  <NA>            <NA>       <NA> 
##  7 PRJNA789389 SRR1… PRJNA… Gmax          8     ERes            Res        <NA> 
##  8 PRJNA789389 SRR1… PRJNA… Gmax          8     ERes            Res        <NA> 
##  9 PRJNA789389 SRR1… PRJNA… Gmax          8     ERes            Res        <NA> 
## 10 PRJNA789389 SRR1… PRJNA… Gmax          4     ERes            Res        <NA> 
## 11 PRJNA789389 SRR1… PRJNA… Gmax          4     ERes            Res        <NA> 
## 12 PRJNA789389 SRR1… PRJNA… Gmax          4     E               Susc       <NA> 
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA789389"
# Had to exclude sample, only one rep
this_meta <- meta %>% filter(bioproject == bpr, !is.na(resistance), sample != "PRJNA789389_SsclNB5_lesion_GmaxACColibri_leaf_4hpi")
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_resistance_contrast_mat(this_meta)

resistance_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ resistance + hpi, kind = "resistance")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 208 rows containing non-finite values (`stat_bin()`).

##                            up down    n
## PRJNA789389_Gmax_SuscvsRes  0    0 9556
bpr <- "PRJNA789389"
this_meta <- meta %>% filter(bioproject == bpr)
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 48 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 11 rows containing non-finite values (`stat_bin()`).

##                        up down    n
## PRJNA789389_GmaxvsIV 2203 2122 9642
bpr <- "PRJNA789389"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(ipvsivtp)) %>% mutate(ipvsivtp = factor(gsub("Res$", "", ipvsivtp)))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_ipvsivtp_contrast_mat(this_meta)

ipvsiv_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ ipvsivtp, kind = "ipvsivtp")
## converting counts to integer mode
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 48 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 11 rows containing non-finite values (`stat_bin()`).

##                          up down    n
## PRJNA789389_Gmax_EvsIV 2203 2122 9642

PRJNA804213

bpr <- "PRJNA804213"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 55 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            Susc       <NA> 
##  2 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            Res        <NA> 
##  3 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            Res        <NA> 
##  4 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            Res        <NA> 
##  5 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            Susc       <NA> 
##  6 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            <NA>       <NA> 
##  7 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            <NA>       <NA> 
##  8 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            <NA>       <NA> 
##  9 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            Susc       <NA> 
## 10 PRJNA804213 SRR1… PRJNA… Lsat          42    <NA>            Susc       <NA> 
## # ℹ 45 more rows
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA804213"
this_meta <- meta %>% filter(bioproject == bpr, !is.na(resistance))
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_resistance_contrast_mat(this_meta)

resistance_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ resistance, kind = "resistance")
## converting counts to integer mode
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 116 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

##                             up down    n
## PRJNA804213_Lsat_SuscvsRes 101  383 9078

PRJNA830457

bpr <- "PRJNA830457"
meta %>% filter(bioproject == bpr) %>% select(bioproject, sra, sample, host_tidyname, hpi, infection_stage, resistance, virus, ipvsivtp)
## # A tibble: 11 × 9
##    bioproject  sra   sample host_tidyname hpi   infection_stage resistance virus
##    <chr>       <chr> <fct>  <fct>         <fct> <fct>           <fct>      <fct>
##  1 PRJNA830457 SRR1… PRJNA… Brap          24    <NA>            <NA>       <NA> 
##  2 PRJNA830457 SRR1… PRJNA… Brap          24    <NA>            <NA>       <NA> 
##  3 PRJNA830457 SRR1… PRJNA… Bnap          24    M               <NA>       <NA> 
##  4 PRJNA830457 SRR1… PRJNA… Brap          24    <NA>            <NA>       <NA> 
##  5 PRJNA830457 SRR1… PRJNA… Bnap          24    M               <NA>       <NA> 
##  6 PRJNA830457 SRR1… PRJNA… Bnap          24    M               <NA>       <NA> 
##  7 PRJNA830457 SRR1… PRJNA… Bnap          24    M               <NA>       <NA> 
##  8 PRJNA830457 SRR1… PRJNA… Bole          24    <NA>            <NA>       <NA> 
##  9 PRJNA830457 SRR1… PRJNA… Bnap          24    M               <NA>       <NA> 
## 10 PRJNA830457 SRR1… PRJNA… Bole          24    <NA>            <NA>       <NA> 
## 11 PRJNA830457 SRR1… PRJNA… Bole          24    <NA>            <NA>       <NA> 
## # ℹ 1 more variable: ipvsivtp <fct>
bpr <- "PRJNA830457"
this_meta <- meta %>% filter(bioproject == bpr, sample != "PRJNA830457_Sscl_periphery_BnapResynthesized_leaf_24hpi")
this_lcounts <- lcounts %>% filter(sra %in% this_meta[["sra"]])
contrasts <- process_host_contrast_mat(this_meta)

host_results[[bpr]] <- run_deg_tests(this_lcounts, this_meta, contrasts, design = ~ host_tidyname, kind = "host")
## converting counts to integer mode
## factor levels were dropped which had no samples
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing

## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 78 rows containing non-finite values (`stat_bin()`).

##                          up down    n
## PRJNA830457_BnapvsBrap  672 1122 9037
## PRJNA830457_BolevsBrap  663 1322 9037
## PRJNA830457_BrapvsBnap 1122  672 9037
## PRJNA830457_BolevsBnap  235  145 9037
## PRJNA830457_BrapvsBole 1322  663 9037
## PRJNA830457_BnapvsBole  145  235 9037

Yay! They’re all done. Now I need to combine the results and turn it into something we can use for the next steps.

host_results_df <- do.call(rbind, host_results)
head(host_results_df)
##               contrast_group  bioproject             contrast host1 host2
## PRJNA261444.1         IPvsIV PRJNA261444 PRJNA261444_PsatvsIV  Psat    IV
## PRJNA261444.2         IPvsIV PRJNA261444 PRJNA261444_PsatvsIV  Psat    IV
## PRJNA261444.3         IPvsIV PRJNA261444 PRJNA261444_PsatvsIV  Psat    IV
## PRJNA261444.4         IPvsIV PRJNA261444 PRJNA261444_PsatvsIV  Psat    IV
## PRJNA261444.5         IPvsIV PRJNA261444 PRJNA261444_PsatvsIV  Psat    IV
## PRJNA261444.6         IPvsIV PRJNA261444 PRJNA261444_PsatvsIV  Psat    IV
##               infection_stage1 infection_stage2 virus1 virus2 resistance1
## PRJNA261444.1             <NA>             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.2             <NA>             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.3             <NA>             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.4             <NA>             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.5             <NA>             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.6             <NA>             <NA>   <NA>   <NA>        <NA>
##               resistance2              id  basemean         lfc    lfc_se
## PRJNA261444.1        <NA> sscle_01g000010  81.68185  0.09959058 0.1355412
## PRJNA261444.2        <NA> sscle_01g000020 201.58016  0.17275916 0.1996748
## PRJNA261444.3        <NA> sscle_01g000030  62.74210  0.13705699 0.1934593
## PRJNA261444.4        <NA> sscle_01g000040 122.67556 -0.86020633 0.1787861
## PRJNA261444.5        <NA> sscle_01g000050 249.90577  3.42635491 0.3967047
## PRJNA261444.6        <NA> sscle_01g000060 170.27916  0.45874431 0.1430046
##                     stat       pvalue         padj
## PRJNA261444.1  0.7347625 4.624841e-01 5.327741e-01
## PRJNA261444.2  0.8652026 3.869276e-01 4.575199e-01
## PRJNA261444.3  0.7084540 4.786634e-01 5.483752e-01
## PRJNA261444.4 -4.8113720 1.498977e-06 8.184891e-06
## PRJNA261444.5  8.6370425 5.768695e-18 2.158795e-16
## PRJNA261444.6  3.2078992 1.337083e-03 3.194997e-03
test <- host_results_df %>% mutate(dge = padj < 0.01) %>% filter(host2 == "IV") %>% tidyr::pivot_wider(id_cols = id, names_from = contrast, values_from = dge) %>%
  column_to_rownames("id") %>%
  as.matrix()

test[is.na(test)] <- FALSE
test <- test[!apply(test, MARGIN = 1, FUN = all), ]
test <- test[rowMeans(1.0 * test) > 0.1, ]
heatmap(1.0 * test, scale = "none")

test <- host_results_df %>% mutate(dge = padj < 0.01) %>% filter(host2 != "IV") %>% tidyr::pivot_wider(id_cols = id, names_from = contrast, values_from = dge) %>%
  column_to_rownames("id") %>%
  as.matrix()

test[is.na(test)] <- FALSE
test <- test[!apply(test, MARGIN = 1, FUN = all), ]
test <- test[rowMeans(1.0 * test) > 0.1, ]
heatmap(1.0 * test, scale = "none")

ipvsiv_results_df <- do.call(rbind, ipvsiv_results)
head(ipvsiv_results_df)
##               contrast_group  bioproject               contrast host1 host2
## PRJNA261444.1       IPvsIV_E PRJNA261444 PRJNA261444_Psat_EvsIV  Psat    IV
## PRJNA261444.2       IPvsIV_E PRJNA261444 PRJNA261444_Psat_EvsIV  Psat    IV
## PRJNA261444.3       IPvsIV_E PRJNA261444 PRJNA261444_Psat_EvsIV  Psat    IV
## PRJNA261444.4       IPvsIV_E PRJNA261444 PRJNA261444_Psat_EvsIV  Psat    IV
## PRJNA261444.5       IPvsIV_E PRJNA261444 PRJNA261444_Psat_EvsIV  Psat    IV
## PRJNA261444.6       IPvsIV_E PRJNA261444 PRJNA261444_Psat_EvsIV  Psat    IV
##               infection_stage1 infection_stage2 virus1 virus2 resistance1
## PRJNA261444.1                E             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.2                E             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.3                E             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.4                E             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.5                E             <NA>   <NA>   <NA>        <NA>
## PRJNA261444.6                E             <NA>   <NA>   <NA>        <NA>
##               resistance2              id  basemean         lfc    lfc_se
## PRJNA261444.1        <NA> sscle_01g000010  81.68185 -0.22294430 0.1938358
## PRJNA261444.2        <NA> sscle_01g000020 201.58016  0.77190153 0.2264886
## PRJNA261444.3        <NA> sscle_01g000030  62.74210 -0.04484968 0.2678259
## PRJNA261444.4        <NA> sscle_01g000040 122.67556 -0.53204966 0.2516354
## PRJNA261444.5        <NA> sscle_01g000050 249.90577  1.19253308 0.4966478
## PRJNA261444.6        <NA> sscle_01g000060 170.27916  0.59324453 0.1754017
##                     stat       pvalue        padj
## PRJNA261444.1 -1.1501710 0.2500734438 0.397596922
## PRJNA261444.2  3.4081253 0.0006541086 0.004635114
## PRJNA261444.3 -0.1674584 0.8670094028 0.918455683
## PRJNA261444.4 -2.1143671 0.0344839287 0.097383799
## PRJNA261444.5  2.4011643 0.0163429950 0.055370236
## PRJNA261444.6  3.3822048 0.0007190652 0.004984220
test <- ipvsiv_results_df %>% mutate(dge = padj < 0.01) %>% tidyr::pivot_wider(id_cols = id, names_from = contrast, values_from = dge) %>%
  column_to_rownames("id") %>%
  as.matrix()

test[is.na(test)] <- FALSE
test <- test[!apply(test, MARGIN = 1, FUN = all), ]
test <- test[rowMeans(1.0 * test) > 0.1, ]
heatmap(1.0 * test, scale = "none")

resistance_results_df <- do.call(rbind, resistance_results)
head(resistance_results_df)
##               contrast_group  bioproject                   contrast host1 host2
## PRJNA261444.1      SuscvsRes PRJNA261444 PRJNA261444_Psat_SuscvsRes  Psat  Psat
## PRJNA261444.2      SuscvsRes PRJNA261444 PRJNA261444_Psat_SuscvsRes  Psat  Psat
## PRJNA261444.3      SuscvsRes PRJNA261444 PRJNA261444_Psat_SuscvsRes  Psat  Psat
## PRJNA261444.4      SuscvsRes PRJNA261444 PRJNA261444_Psat_SuscvsRes  Psat  Psat
## PRJNA261444.5      SuscvsRes PRJNA261444 PRJNA261444_Psat_SuscvsRes  Psat  Psat
## PRJNA261444.6      SuscvsRes PRJNA261444 PRJNA261444_Psat_SuscvsRes  Psat  Psat
##               infection_stage1 infection_stage2 virus1 virus2 resistance1
## PRJNA261444.1             <NA>             <NA>   <NA>   <NA>        Susc
## PRJNA261444.2             <NA>             <NA>   <NA>   <NA>        Susc
## PRJNA261444.3             <NA>             <NA>   <NA>   <NA>        Susc
## PRJNA261444.4             <NA>             <NA>   <NA>   <NA>        Susc
## PRJNA261444.5             <NA>             <NA>   <NA>   <NA>        Susc
## PRJNA261444.6             <NA>             <NA>   <NA>   <NA>        Susc
##               resistance2              id  basemean         lfc    lfc_se
## PRJNA261444.1         Res sscle_01g000010  63.39380 -0.12520616 0.2020148
## PRJNA261444.2         Res sscle_01g000020 161.56726  0.26485539 0.2377691
## PRJNA261444.3         Res sscle_01g000030  49.05560  0.02767964 0.2568147
## PRJNA261444.4         Res sscle_01g000040  72.86261 -0.19986247 0.2654807
## PRJNA261444.5         Res sscle_01g000050 274.16510  0.66549984 0.3806095
## PRJNA261444.6         Res sscle_01g000060 143.16051  0.07956455 0.1982215
##                     stat    pvalue      padj
## PRJNA261444.1 -0.6197870 0.5353980 0.9992214
## PRJNA261444.2  1.1139182 0.2653143 0.9992214
## PRJNA261444.3  0.1077806 0.9141698 0.9992214
## PRJNA261444.4 -0.7528325 0.4515506 0.9992214
## PRJNA261444.5  1.7485109 0.0803756 0.9992214
## PRJNA261444.6  0.4013922 0.6881314 0.9992214
test <- resistance_results_df %>% mutate(dge = padj < 0.01) %>% tidyr::pivot_wider(id_cols = id, names_from = contrast, values_from = dge) %>%
  column_to_rownames("id") %>%
  as.matrix()

test[is.na(test)] <- FALSE
test <- test[!apply(test, MARGIN = 1, FUN = all), ]
test <- test[rowMeans(1.0 * test) > 0.1, ]
heatmap(1.0 * test, scale = "none")

stage_results_df <- do.call(rbind, stage_results)
head(stage_results_df)
##               contrast_group  bioproject              contrast host1 host2
## PRJNA261444.1           MvsE PRJNA261444 PRJNA261444_Psat_MvsE  Psat  Psat
## PRJNA261444.2           MvsE PRJNA261444 PRJNA261444_Psat_MvsE  Psat  Psat
## PRJNA261444.3           MvsE PRJNA261444 PRJNA261444_Psat_MvsE  Psat  Psat
## PRJNA261444.4           MvsE PRJNA261444 PRJNA261444_Psat_MvsE  Psat  Psat
## PRJNA261444.5           MvsE PRJNA261444 PRJNA261444_Psat_MvsE  Psat  Psat
## PRJNA261444.6           MvsE PRJNA261444 PRJNA261444_Psat_MvsE  Psat  Psat
##               infection_stage1 infection_stage2 virus1 virus2 resistance1
## PRJNA261444.1                M                E   <NA>   <NA>        <NA>
## PRJNA261444.2                M                E   <NA>   <NA>        <NA>
## PRJNA261444.3                M                E   <NA>   <NA>        <NA>
## PRJNA261444.4                M                E   <NA>   <NA>        <NA>
## PRJNA261444.5                M                E   <NA>   <NA>        <NA>
## PRJNA261444.6                M                E   <NA>   <NA>        <NA>
##               resistance2              id  basemean        lfc    lfc_se
## PRJNA261444.1        <NA> sscle_01g000010  63.39380  0.3368835 0.2556646
## PRJNA261444.2        <NA> sscle_01g000020 161.56726 -0.8293147 0.2921536
## PRJNA261444.3        <NA> sscle_01g000030  49.05560  0.1377882 0.3221188
## PRJNA261444.4        <NA> sscle_01g000040  72.86261 -0.5170600 0.3279450
## PRJNA261444.5        <NA> sscle_01g000050 274.16510  3.1391853 0.4729186
## PRJNA261444.6        <NA> sscle_01g000060 143.16051 -0.5951052 0.2470258
##                     stat       pvalue         padj
## PRJNA261444.1  1.3176777 1.876116e-01 3.998384e-01
## PRJNA261444.2 -2.8386261 4.530822e-03 3.117970e-02
## PRJNA261444.3  0.4277559 6.688288e-01 8.176990e-01
## PRJNA261444.4 -1.5766668 1.148722e-01 2.947843e-01
## PRJNA261444.5  6.6378983 3.181873e-11 1.449168e-09
## PRJNA261444.6 -2.4090807 1.599276e-02 8.009383e-02
test <- stage_results_df %>% mutate(dge = padj < 0.01) %>% tidyr::pivot_wider(id_cols = id, names_from = contrast, values_from = dge) %>%
  column_to_rownames("id") %>%
  as.matrix()

test[is.na(test)] <- FALSE
test <- test[!apply(test, MARGIN = 1, FUN = all), ]
test <- test[rowMeans(1.0 * test) > 0.1, ]
heatmap(1.0 * test, scale = "none")

virus_results_df <- do.call(rbind, virus_results)
head(virus_results_df)
##               contrast_group  bioproject                    contrast host1
## PRJNA577619.1     SsHADVvsVF PRJNA577619 PRJNA577619_Bnap_SsHADVvsVF  Bnap
## PRJNA577619.2     SsHADVvsVF PRJNA577619 PRJNA577619_Bnap_SsHADVvsVF  Bnap
## PRJNA577619.3     SsHADVvsVF PRJNA577619 PRJNA577619_Bnap_SsHADVvsVF  Bnap
## PRJNA577619.4     SsHADVvsVF PRJNA577619 PRJNA577619_Bnap_SsHADVvsVF  Bnap
## PRJNA577619.5     SsHADVvsVF PRJNA577619 PRJNA577619_Bnap_SsHADVvsVF  Bnap
## PRJNA577619.6     SsHADVvsVF PRJNA577619 PRJNA577619_Bnap_SsHADVvsVF  Bnap
##               host2 infection_stage1 infection_stage2 virus1 virus2 resistance1
## PRJNA577619.1  Bnap             <NA>             <NA> SsHADV     VF        <NA>
## PRJNA577619.2  Bnap             <NA>             <NA> SsHADV     VF        <NA>
## PRJNA577619.3  Bnap             <NA>             <NA> SsHADV     VF        <NA>
## PRJNA577619.4  Bnap             <NA>             <NA> SsHADV     VF        <NA>
## PRJNA577619.5  Bnap             <NA>             <NA> SsHADV     VF        <NA>
## PRJNA577619.6  Bnap             <NA>             <NA> SsHADV     VF        <NA>
##               resistance2              id  basemean           lfc     lfc_se
## PRJNA577619.1        <NA> sscle_01g000010  642.1129  0.0003574257 0.05808034
## PRJNA577619.2        <NA> sscle_01g000020  577.5309  0.1094555731 0.04911522
## PRJNA577619.3        <NA> sscle_01g000030  292.4309 -0.2793445738 0.06332580
## PRJNA577619.4        <NA> sscle_01g000040  789.6878 -0.0489422383 0.03656551
## PRJNA577619.5        <NA> sscle_01g000050 1056.6621 -1.7131604014 0.07672040
## PRJNA577619.6        <NA> sscle_01g000060  619.5722 -0.0601729976 0.07725617
##                        stat        pvalue          padj
## PRJNA577619.1   0.006153988  9.950899e-01  9.957773e-01
## PRJNA577619.2   2.228546926  2.584407e-02  3.554530e-02
## PRJNA577619.3  -4.411228184  1.027859e-05  2.045129e-05
## PRJNA577619.4  -1.338480875  1.807397e-01  2.172326e-01
## PRJNA577619.5 -22.329921468 1.892596e-110 5.652423e-109
## PRJNA577619.6  -0.778876291  4.360526e-01  4.846826e-01
test <- virus_results_df %>% mutate(dge = padj < 0.01) %>% tidyr::pivot_wider(id_cols = id, names_from = contrast, values_from = dge) %>%
  column_to_rownames("id") %>%
  as.matrix()

test[is.na(test)] <- FALSE
test <- test[!apply(test, MARGIN = 1, FUN = all), ]
test <- test[rowMeans(1.0 * test) > 0.1, ]
heatmap(1.0 * test, scale = "none")

all_results <- list("ipvsiv" = ipvsiv_results_df, "infection_stage" = stage_results_df, "host" = host_results_df, "resistance" = resistance_results_df, "virus" = virus_results_df)
writexl::write_xlsx(all_results, "output/dge_tests.xlsx")

Getting counts

run_count_norm <- function(lcounts, meta, bpr) {
  this_counts <- lcounts %>% filter(bioproject == bpr)  %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = count) %>%
    column_to_rownames("id") %>%
    as.matrix()
  
  this_meta <- meta %>% filter(bioproject == bpr) %>% column_to_rownames("sra") %>% mutate(sample = factor(sample)) %>% .[colnames(this_counts), ]
  stopifnot(all(rownames(this_meta) == colnames(this_counts)))

  dds <- DESeqDataSetFromMatrix(
    countData = this_counts,
    colData = this_meta,
    design = ~ 1
  )
  
  ncounts <- assay(rlog(dds, blind = TRUE))
  print(plotPCA(rlog(dds, blind = FALSE), intgroup = "sample"))
  
  return(ncounts)
}


lcounts_tmp <- lcounts %>% filter(included %in% c("TRUE", "NETWORK_ONLY"))

norm_counts <- list()

for (bpr in unique(lcounts_tmp[["bioproject"]])) {
  norm_counts[[bpr]] <- run_count_norm(lcounts, meta, bpr)
}
## converting counts to integer mode
## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation

## converting counts to integer mode
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode
## rlog() may take a long time with 50 or more samples,
## vst() is a much faster transformation
## rlog() may take a long time with 50 or more samples,
## vst() is a much faster transformation

## converting counts to integer mode

## converting counts to integer mode

norm_counts_df <- do.call(cbind, norm_counts)

lcounts <- left_join(
  lcounts,
  as.data.frame(norm_counts_df) %>% rownames_to_column("id") %>% tidyr::pivot_longer(-id, names_to = "sra", values_to = "disp_norm_count"),
  by = c("sra", "id")
)

norm_counts_df[1:5, 1:5]
##                 SRR1582088 SRR1582089 SRR1582090 SRR1582091 SRR1582133
## sscle_01g000010   6.359939   6.066063   6.150973   6.466753   6.427894
## sscle_01g000020   8.055504   8.247401   7.043684   7.715239   7.344198
## sscle_01g000030   6.020265   5.683930   5.547148   6.421591   5.896596
## sscle_01g000040   6.596740   6.900114   6.684489   6.234156   6.897261
## sscle_01g000050   6.654462   6.289451   8.905094   8.375156   9.057057
dim(norm_counts_df)
## [1] 11130   422

That was easy. Let’s look again at the PCA plots.

pca_raw <- princomp(norm_counts_df, fix_sign = TRUE)

prop_var <- ((pca_raw$sdev[1:10] / sum(pca_raw$sdev)) * 100) %>%
  data.frame(variance_explained = .) %>%
  rownames_to_column("PC") %>%
  mutate(PC = paste0("PC", sprintf("%02d", 1:n())))

print(prop_var)
##      PC variance_explained
## 1  PC01          26.155504
## 2  PC02           4.403403
## 3  PC03           2.934259
## 4  PC04           2.799246
## 5  PC05           2.392029
## 6  PC06           2.044596
## 7  PC07           1.878407
## 8  PC08           1.697593
## 9  PC09           1.577894
## 10 PC10           1.520697
ggplot(prop_var, aes(x=PC, y=variance_explained)) + geom_bar(stat = "identity")

pca <- as.data.frame(pca_raw$loadings[, 1:10])
colnames(pca) <- paste0("PC", sprintf("%02d", seq_len(ncol(pca))))
pca <- pca %>% rownames_to_column("sra")
pca <- right_join(meta, pca, by = "sra")
gg1 <- pca %>%
  select(sra, host = host_tidyname, bioproject, PC01, PC02, PC03) %>%
  tidyr::pivot_longer(cols = c(PC01, PC02, PC03)) %>%
  full_join(., ., by=c("sra", "host", "bioproject")) %>%
  unique() %>%
  ggplot(aes(x=value.x, y=value.y, colour = host, shape = host)) +
  geom_point(size = 2, alpha = 0.6) +
  facet_grid(rows = vars(name.y), cols = vars(name.x), scales = "free") +
  theme(aspect.ratio = 1)
## Warning in full_join(., ., by = c("sra", "host", "bioproject")): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 1 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
gg1 <- gg_shape(gg1, pca$host)

gg2 <- pca %>%
  select(sra, host = host_tidyname, bioproject, PC01, PC02, PC03) %>%
  tidyr::pivot_longer(cols = c(PC01, PC02, PC03)) %>%
  full_join(., ., by=c("sra", "host", "bioproject")) %>%
  unique() %>%
  ggplot(aes(x=value.x, y=value.y, colour = bioproject, shape = bioproject)) +
  geom_point(size = 2, alpha = 0.6) +
  facet_grid(rows = vars(name.y), cols = vars(name.x), scales = "free") +
  theme(aspect.ratio = 1)
## Warning in full_join(., ., by = c("sra", "host", "bioproject")): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 1 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
gg2 <- gg_shape(gg2, pca$bioproject)
library(cowplot)
## 
## Attaching package: 'cowplot'
## The following object is masked from 'package:lubridate':
## 
##     stamp
gg <- plot_grid(gg1, gg2, ncol = 1, align = "hv")
ggsave("output/deseq_norm_pca.svg", gg, height = 10, width = 10)
gg

It’s a bit less crazy, which I like. I think there’s some nice clustering of hosts in there, so it seems like it should be possible to pull interesting things from this.

So in an ideal world, you’d have most of the variation explained by factors of interest. I do see a general clustering of samples from the same bioprojects. But there also tend to be similar treatments within each bioproject, so it’s difficult to tell.

We’ll have to see. Maybe I can remove some of these effects. I was planning to SVA to do this, but it seems like it can’t handle the DESeq2 counts shrunk counts. So i’ll run ComBat_seq on the raw data and redo the rlog shrinkage. Unfortunately, i can’t seem to include any of the covariates of interest in the ComBat model as they’re all confounded with the BioProject. So we’ll have to see if it removes any factors of interest.

batch <- setNames(meta[["bioproject"]], meta[["sra"]])[colnames(norm_counts_df)]
tmp <- as.data.frame(column_to_rownames(meta, "sra")[colnames(norm_counts_df), ])
tmp[is.na(tmp)] <- "NA"
## Warning in `[<-.factor`(`*tmp*`, thisvar, value = "NA"): invalid factor level,
## NA generated

## Warning in `[<-.factor`(`*tmp*`, thisvar, value = "NA"): invalid factor level,
## NA generated

## Warning in `[<-.factor`(`*tmp*`, thisvar, value = "NA"): invalid factor level,
## NA generated

## Warning in `[<-.factor`(`*tmp*`, thisvar, value = "NA"): invalid factor level,
## NA generated

## Warning in `[<-.factor`(`*tmp*`, thisvar, value = "NA"): invalid factor level,
## NA generated
tmp_counts <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = count) %>%
  column_to_rownames("id") %>%
  as.matrix()

mm <- model.matrix(~as.factor(sample), data=tmp)

# Paper says that applying shrinkage at this point is unnecessary.
combat_edata <- ComBat_seq(
  tmp_counts,
  batch=batch,
  group=NULL,
  shrink.disp = FALSE,
  shrink = FALSE
)
## Found 30 batches
## Using null model in ComBat-seq.
## Adjusting for 0 covariate(s) or covariate level(s)
## Estimating dispersions
## Fitting the GLM model
## Shrinkage off - using GLM estimates for parameters
## Adjusting the data
combat_edata[1:5, 1:5]
##                 SRR1582088 SRR1582089 SRR1582090 SRR1582091 SRR1582133
## sscle_01g000010         35         45         59         57        184
## sscle_01g000020         72        167         65         82        177
## sscle_01g000030         17         18         15         46         65
## sscle_01g000040         32         74         78         44        176
## sscle_01g000050         50         73        628        290       1436
lcounts <- left_join(
  lcounts,
  as.data.frame(combat_edata) %>% rownames_to_column("id") %>% tidyr::pivot_longer(-id, names_to = "sra", values_to = "batch_norm_count"),
  by = c("sra", "id")
)
head(lcounts)
## # A tibble: 6 × 29
##   sra        bioproject  included sample    organism organism_tidyname accession
##   <chr>      <chr>       <chr>    <fct>     <chr>    <chr>             <chr>    
## 1 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 2 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 3 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 4 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 5 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## 6 SRR1582088 PRJNA261444 TRUE     PRJNA261… Sclerot… Sscl              Scl02-05 
## # ℹ 22 more variables: accession_tidyname <chr>, host <chr>,
## #   host_tidyname <fct>, host_accession <chr>, host_accession_tidyname <chr>,
## #   tissue <chr>, hpi <fct>, plant_tissue <chr>, treatment <chr>,
## #   treatment_tidy <chr>, sample_material <chr>, host_ <chr>, organism_ <chr>,
## #   infection_stage <fct>, resistance <fct>, virus <fct>, ipvsivtp <fct>,
## #   id <chr>, count <dbl>, cpm <dbl>, disp_norm_count <dbl>,
## #   batch_norm_count <dbl>

Ok. So we’ve done the batch correction, now we do the DESeq correction again.

run_count_norms2 <- function(lcounts, bpr) {
  this_counts <- lcounts %>% filter(bioproject == bpr)  %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = batch_norm_count) %>%
    column_to_rownames("id") %>%
    as.matrix()
  
  all(rownames(this_meta) == colnames(this_counts))
  this_meta_ <- this_meta %>% column_to_rownames("sra") %>% mutate(sample = factor(sample)) %>% .[colnames(this_counts), ]
  
  dds <- DESeqDataSetFromMatrix(
    countData = this_counts,
    colData = this_meta_,
    design = ~ 1
  )
  
  ncounts <- assay(rlog(dds, blind = TRUE))
  print(plotPCA(rlog(dds, blind = FALSE), intgroup = "sample"))
  
  return(ncounts)
}

norm_counts <- list()

for (bpr in unique(meta$bioproject)) {
  this_meta <- meta %>% filter(bioproject == bpr)
  norm_counts[[bpr]] <- run_count_norms2(lcounts, bpr)
}
## converting counts to integer mode
## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation

## converting counts to integer mode
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode

## converting counts to integer mode
## rlog() may take a long time with 50 or more samples,
## vst() is a much faster transformation
## rlog() may take a long time with 50 or more samples,
## vst() is a much faster transformation

## converting counts to integer mode

## converting counts to integer mode

norm_counts_df <- do.call(cbind, norm_counts)

lcounts <- left_join(
  lcounts,
  as.data.frame(norm_counts_df) %>% rownames_to_column("id") %>% tidyr::pivot_longer(-id, names_to = "sra", values_to = "norm_count"),
  by = c("sra", "id")
)

norm_counts_df[1:5, 1:5]
##                 SRR1582088 SRR1582089 SRR1582090 SRR1582091 SRR1582133
## sscle_01g000010   7.072656   6.711151   6.802304   7.135453   7.188496
## sscle_01g000020   7.913726   8.082829   7.092964   7.646709   7.331486
## sscle_01g000030   5.978562   5.480902   5.224116   6.514275   5.810956
## sscle_01g000040   7.038773   7.194144   7.093917   6.949972   7.188252
## sscle_01g000050   7.718862   7.467015   9.415718   9.025624   9.543757
dim(norm_counts_df)
## [1] 11130   422

The per bioproject PCA plots look very similar to the others, though it’s difficult to compare them scrolling up and down. Now let’s look at the whole PCA.

tmp_counts <- apply(norm_counts_df, MARGIN = 2, FUN = scale)
rownames(tmp_counts) <- rownames(norm_counts_df)
colnames(tmp_counts) <- colnames(norm_counts_df)

tmp_counts[is.na(tmp_counts)] <- 0
pca_raw <- princomp(tmp_counts, fix_sign = TRUE)

prop_var <- ((pca_raw$sdev[1:10] / sum(pca_raw$sdev)) * 100) %>%
  data.frame(variance_explained = .) %>%
  rownames_to_column("PC") %>%
  mutate(PC = paste0("PC", sprintf("%02d", 1:n())))

print(prop_var)
##      PC variance_explained
## 1  PC01          27.825656
## 2  PC02           3.130342
## 3  PC03           2.820906
## 4  PC04           2.095826
## 5  PC05           1.723563
## 6  PC06           1.442321
## 7  PC07           1.334999
## 8  PC08           1.271084
## 9  PC09           1.156804
## 10 PC10           1.122988
ggplot(prop_var, aes(x=PC, y=variance_explained)) + geom_bar(stat = "identity")

We’ve jumped from the first PC explaining ~23% of the variance to ~27%. It’s not much of a difference.

pca <- as.data.frame(pca_raw$loadings[, 1:10])
colnames(pca) <- paste0("PC", sprintf("%02d", seq_len(ncol(pca))))
pca <- pca %>% rownames_to_column("sra")
pca <- right_join(meta %>% select(sra, host_tidyname, bioproject), pca, by = "sra")
gg1 <- pca %>%
  select(sra, host = host_tidyname, bioproject, PC01, PC02, PC03) %>%
  tidyr::pivot_longer(cols = c(PC01, PC02, PC03)) %>%
  full_join(., ., by=c("sra", "host", "bioproject")) %>%
  unique() %>%
  ggplot(aes(x=value.x, y=value.y, colour = host, shape = host)) +
  geom_point(size = 2, alpha = 0.6) +
  facet_grid(rows = vars(name.y), cols = vars(name.x), scales = "free") +
  theme(aspect.ratio = 1)
## Warning in full_join(., ., by = c("sra", "host", "bioproject")): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 1 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
gg1 <- gg_shape(gg1, pca$host)

gg2 <- pca %>%
  select(sra, host = host_tidyname, bioproject, PC01, PC02, PC03) %>%
  tidyr::pivot_longer(cols = c(PC01, PC02, PC03)) %>%
  full_join(., ., by=c("sra", "host", "bioproject")) %>%
  unique() %>%
  ggplot(aes(x=value.x, y=value.y, colour = bioproject, shape = bioproject)) +
  geom_point(size = 2, alpha = 0.6) +
  facet_grid(rows = vars(name.y), cols = vars(name.x), scales = "free") +
  theme(aspect.ratio = 1)
## Warning in full_join(., ., by = c("sra", "host", "bioproject")): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 1 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
gg2 <- gg_shape(gg2, pca$bioproject)
library(cowplot)

gg <- plot_grid(gg1, gg2, ncol = 1, align = "hv")
ggsave("output/combat_norm_pca.svg", gg, height = 10, width = 10)
gg

gg3 <- pca %>%
  select(sra, host = host_tidyname, bioproject, PC01, PC02, PC03) %>%
  tidyr::pivot_longer(cols = c(PC01, PC02, PC03)) %>%
  unique() %>%
  ggplot(aes(x=value)) +
  geom_histogram(fill = "black") +
  facet_grid(cols = vars(name), scales = "free")

print(gg3)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Yeah i do think that the PCs are maybe a bit tidier. I definitely still see groupings of samples from the same bioproject, but probably it’s unavoidable. Maybe i’ll look at correlation matrices.

Here’s the one from the ComBat normalised counts.

tmp <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = norm_count) %>%
  column_to_rownames("id") %>%
  as.matrix()

meta_tmp <- meta[order(meta$host, meta$host_accession, meta$hpi, meta$tissue, meta$accession, meta$plant_tissue, meta$treatment),]
tmp <- tmp[, meta_tmp$sra[meta_tmp$sra %in% colnames(tmp)]]

tmp_cor <- cor(tmp)
#tmp_dist <- as.dist(1 - tmp_cor)
#hcl <- hclust(tmp_dist, method = "average")

#srrs <- colnames(tmp)[hcl$order]
ha <- HeatmapAnnotation(
  bioproject = meta %>% column_to_rownames("sra") %>% .[colnames(tmp), "bioproject"],
  host = meta %>% column_to_rownames("sra") %>% .[colnames(tmp), "host"]
)

ht <- Heatmap(
  tmp_cor,
  name = "samples",
  cluster_rows = FALSE,
  cluster_columns = FALSE,
  show_column_dend = FALSE,
  show_column_names = FALSE,
  show_row_names = FALSE,
  top_annotation = ha,
  height=nrow(tmp_cor) * unit(0.5, "mm"),
  width=ncol(tmp_cor) * unit(0.5, "mm")
)

htsize <- calc_ht_size(ht)
htsize
## [1] 12.409344  8.906201
pdf("output/06-samples_correlation_host_normed.pdf", width = htsize[1], height = htsize[2])
ht
dev.off()
## png 
##   2
draw(ht)

Well the clusters in here certainly make more sense than from the raw data. I’ve looked at the data, and i don’t think a log transformation is necessary.

And here’s the one from the dispersion normalised counts (i.e. DESeq but no ComBat).

tmp <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = disp_norm_count) %>%
  column_to_rownames("id") %>%
  as.matrix()

meta_tmp <- meta[order(meta$host, meta$host_accession, meta$hpi, meta$tissue, meta$accession, meta$plant_tissue, meta$treatment),]
tmp <- tmp[, meta_tmp$sra[meta_tmp$sra %in% colnames(tmp)]]

tmp_cor <- cor(tmp)
#tmp_dist <- as.dist(1 - tmp_cor)
#hcl <- hclust(tmp_dist, method = "average")

#srrs <- colnames(tmp)[hcl$order]
ha <- HeatmapAnnotation(
  bioproject = meta %>% column_to_rownames("sra") %>% .[colnames(tmp), "bioproject"],
  host = meta %>% column_to_rownames("sra") %>% .[colnames(tmp), "host"]
)

ht <- Heatmap(
  tmp_cor,
  name = "samples",
  cluster_rows = FALSE,
  cluster_columns = FALSE,
  show_column_dend = FALSE,
  show_column_names = FALSE,
  show_row_names = FALSE,
  top_annotation = ha,
  height=nrow(tmp_cor) * unit(0.5, "mm"),
  width=ncol(tmp_cor) * unit(0.5, "mm")
)

htsize <- calc_ht_size(ht)
htsize
## [1] 12.409344  8.906201
pdf("output/06-samples_correlation_host_normed.pdf", width = htsize[1], height = htsize[2])
ht
dev.off()
## png 
##   2
draw(ht)

These look almost identical. I think that because the extra amount of variance explained is relatively low, and the results look fairly similar, i won’t continue with the ComBat normalised counts. There’s a risk that removing the bioproject effect might remove some information about treatments (esp because I wasn’t able to provide info about treatments). The benefits don’t seem to outweigh the risks.

I’d like to see what we can do with gene level correlation. Do the gene expression values look ok?

tmp <- lcounts %>% tidyr::pivot_wider(id_cols = c(id), names_from = sra, values_from = disp_norm_count) %>%
  column_to_rownames("id") %>%
  as.matrix()

meta_tmp <- meta[order(meta$host, meta$host_accession, meta$hpi, meta$tissue, meta$accession, meta$plant_tissue, meta$treatment),]
tmp <- tmp[, meta_tmp$sra[meta_tmp$sra %in% colnames(tmp)]]

# There are two genes with no counts in any samples.
# We need to exclude them for the correlation to work.
# Causes error about stddev == 0.
tmp_cor_disp <- cor(t(tmp[(rowSums(tmp) > 0), ]))

quantile(tmp_cor_disp)
##         0%        25%        50%        75%       100% 
## -0.7846495  0.5544744  0.7351301  0.8567367  1.0000000

Yeah that seems like a reasonable range of values. I think probably the number of genes with mid correlation (~0.5-0.8) is caused by genes with relatively low variation across treatments. I suspect that once we remove those genes we’ll see cleaner differences.

pca_raw <- prcomp(t(tmp), retx = TRUE)

prop_var <- ((pca_raw$sdev[1:10] / sum(pca_raw$sdev)) * 100) %>%
  data.frame(variance_explained = .) %>%
  rownames_to_column("PC") %>%
  mutate(PC = paste0("PC", sprintf("%02d", 1:n())))

print(prop_var)
##      PC variance_explained
## 1  PC01          13.469627
## 2  PC02           5.838185
## 3  PC03           3.470201
## 4  PC04           3.183223
## 5  PC05           2.496956
## 6  PC06           2.263763
## 7  PC07           2.100551
## 8  PC08           1.946407
## 9  PC09           1.836716
## 10 PC10           1.587257
ggplot(prop_var, aes(x=PC, y=variance_explained)) + geom_bar(stat = "identity")

pca <- as.data.frame(pca_raw$rotation[, 1:10])
colnames(pca) <- paste0("PC", sprintf("%02d", seq_len(ncol(pca))))
pca <- pca %>% rownames_to_column("id")

gg <- ggplot(pca, aes(x=PC01, y=PC02)) +
  geom_point(alpha = 0.7, size = 3)

print(gg)

gg <- ggplot(pca, aes(x=PC03, y=PC04)) +
  geom_point(alpha = 0.7, size = 3)

gg

I guess the values look fine. It’s a bit hard to say but there aren’t like crazy clusters or massive outliers.

We’ll continue with the dispersion corrected counts. I just want to check though whether there are mean differences left in the data.

ggplot(lcounts, aes(x = sra, y = disp_norm_count, colour = bioproject)) + geom_boxplot()  + facet_wrap(vars(bioproject), scales = "free_x")

I do see differences in mean and scale between bioprojects. They’re pretty similar in terms of the range, but it might be a problem later if we do anything other than correlation clustering. How are the ComBat counts?

ggplot(lcounts, aes(x = sra, y = norm_count, colour = bioproject)) + geom_boxplot()  + facet_wrap(vars(bioproject), scales = "free_x")

I seems like the main contribution here is that some of the crazy outliers in PRJNA670487 are squished. Otherwise the counts have pretty similar ranges.

I think maybe i’m coming back around to ComBat just for the sake of shrinking the outliers?

I’m just going to save them both and we can decide later :)

lcounts %>%
  tidyr::pivot_wider(id_cols = id, names_from = sra, values_from = disp_norm_count) %>%
  readr::write_tsv("output/feature_counts_deseq2_normed.tsv", na = "-")
lcounts %>%
  tidyr::pivot_wider(id_cols = id, names_from = sra, values_from = norm_count) %>%
  readr::write_tsv("output/feature_counts_combat_normed.tsv", na = "-")

BYEEE!